[Chameleon] Billingual method of selecting map file?
Jason Fournier
jfournier at dmsolutions.ca
Fri Sep 24 18:28:25 EDT 2004
When i print_r( $oApp ) I have a key called mszCurrentLanguage at the
top level. This is in Chameleon 1.99 Beta2. The value for this key is
null until I change the language through the shared resource. Chameleon
will set this variable when requested to do a language change. The
language must match one of the langauges defined by:
$oApp->CWCAddRegionalTemplate( "en-CA", "foo_en.html");
in order for the code in the previous email to work properly.
So if $oApp['mszCurrentLanguage'] == '' then you are using your default
language. If it is set then you are using the language that corresponds
to the value of $oApp['mszCurrentLanguage'].
Jason
Ken Sanderson wrote:
> Thanks for the reply Jason. Where does mszCurrentLanguage get set?
> $oApp['mszCurrentLanguage'] doesn't return anything from what I can
> tell, so I assume I need to set that somewhere?
>
> Ken
>
> -----Original Message-----
> From: Jason Fournier [mailto:jfournier at dmsolutions.ca]
> Sent: September 24, 2004 3:59 PM
> To: Ken Sanderson
> Cc: chameleon at lists.maptools.org
> Subject: Re: [Chameleon] Billingual method of selecting map file?
>
>
> Ken,
>
> You could detect the current language through something like:
>
> $oApp['mszCurrentLanguage'] in your index.phtml before you call:
>
> $oApp->CWCInitialize( $szTemplate, $szMapFile );
>
> if this string is null then you are using your default your default
> language <else> this variable will contain the key of the language you
> are in (eg, en-CA, fr-CA, etc.).
>
> So in semi-pseudo code you could:
> $szMapName = 'mymap';
> if( language == 'fr-CA' )
> $szMapLang = 'fr';
> else
> $szMapLang = 'en';
>
> $szMapFile = $szMapName . '_' . $szMapLang . '.map';
> $oApp->CWCInitialize( $szTemplate, $szMapFile );
>
> This assumes that you have two mapfiles called:
>
> mymap_en.map
> mymap_fr.map
>
> HTH,
> Jason
>
>
>
> Ken Sanderson wrote:
>
>
>>I have setup the billingual tools and I see how they are selecting
>>different templates based on your language choice, but is there a way
>>to also select a different MAP file to use so that I can make my layer
>
>
>>names Billingual as well?
>>
>>Thanks,
>>
>>Ken
>>
>>
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon at lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon
>>
>
>
--
_____________________________
Jason Fournier
DM Solutions Group Inc.
jfournier at dmsolutions.ca
www.dmsolutions.ca
613.565.5056 x18
More information about the Chameleon
mailing list