[Chameleon] Billingual method of selecting map file?

Paul Spencer pagameba at magma.ca
Sat Sep 25 23:09:39 EDT 2004


I'll jump in here.  This approach may not work in an situation where the 
user can switch languages on the fly because Chameleon caches the map 
state by saving copies of the map on each page load.  This has the nasty 
side effect of it not actually using the map file that you specify 
except for the first time the app starts - there may be some code in 
there that detects if the map file name has changed, and reset the 
session cached map file, but this would lose the current state 
(extents/layer visibility).

An alternate solution would be to use language-sensitive metadata for 
naming layers and have the two app templates refer to different html 
legend templates.

Just a thought ...

Jason Fournier wrote:
> Just for clarification ...
> 
> Ken pointed out to me that it's $oApp->mszCurrentLanguage which contains 
> the value, not $oApp['mszCurrentLanguage'].  This, of course, makes 
> perfect sense as it's an object we are dealing with an not an array 
> (hence the o in $oApp :)).
> 
> Sorry for any confusion.
> 
> Coffee 1, Jason 0
> 
> 
> 
> 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
>>>
>>
>>
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



More information about the Chameleon mailing list