[Fwd: [Chameleon] MLT CVS problems]

Normand Savard nsavard at mapgears.com
Wed Mar 8 10:59:45 EST 2006


>
> ------------------------------------------------------------------------
>
> Subject:
> [Chameleon] MLT CVS problems
> From:
> "Bart van den Eijnden" <bartvde at xs4all.nl>
> Date:
> Wed, 8 Mar 2006 14:18:32 +0100 (CET)
> To:
> chameleon at lists.maptools.org
>
> To:
> chameleon at lists.maptools.org
>
>
>Hi list,
>
>Question in advance, what is the correct way to load a different language?
>I have done the following:
>a) set nl-NL in chameleon.xml
>b) $_SESSION['aszLang'] = array( "NL_NL" );
>
>If I do not set b) I get the encoding problem as specified in MT bug 1329.
>
>  
>
There is a known issue described in bug 961.  Right now to make it works 
you need to set the language in chameleon.xml all lower case and the 
same for the '$aszLang' session variable.  You also use "-" instead of 
"_".  If you use the Link widget in the template, you should modify the 
language string as well.

>I have run into a few problems with the latest MLT CVS code:
>
>1) it seems to me txt resources are only loaded from the chameleon widgets
>dir, and not for other widget directories specified.
>
>The code in WidgetManager.php does only the following so this goes wrong
>for widgets not present in the chameleon widget dir:
>
>               $this->moMLT->loadResource( $oWidget->mszWidgetName,
>                                            str_replace("\\","/",
>                                            dirname(__FILE__) ).'/widgets/'.
>                                            $oWidget->mszWidgetName );
>
>  
>
For this one I think we should open a new bug and I will look at it as 
soon as I completed bug 1329.

>2) For popup phtmls, I have a problem with the case and name (- versus _)
>of the text resource files. Using the dbf2text.php file the following is
>created:
>
>[bart at hades GeoservicesBoundingBoxPopup]$ ll *.txt
>-rw-rw-r--    1 bart     geo           424 Mar  7 10:34
>GeoservicesBoundingBoxPopup.en-ca.txt
>-rw-rw-r--    1 bart     geo           475 Mar  7 10:34
>GeoservicesBoundingBoxPopup.fr-ca.txt
>-rw-rw-r--    1 bart     geo           300 Mar  7 10:34
>GeoservicesBoundingBoxPopup.nl-nl.txt
>
>But the php code is looking for ($szResourceFile in loadResource):
>geoservicesboundingboxpopup.NL_NL.txt
>
>  
>
Actually with respect to the language part of the string, it looks for 
the key set by  CWCAddRegionalTemplate chameleon method that sets the 
session variable $aszLang or by using what you suggest in 1b above.  So 
in your case it should look for "NL_NL".  The language resource files 
name are all writen in lower case and this why they are not found.  If 
we follow the ISO standard we must rename our language resource files as 
follow:  "language-COUNTRY" (e.g. fr-CA).

With respect to the widget name part of the language resource files name 
it looks for a combination of upper and lower case characters as in 
"GeoservicesBoundingBoxPopup".  The strtolower() function in mlt 
loadresource() and get() methods have been removed.  You should update 
your mlt.php file.

>3) There also seems to be a problem with the case and - versus _ of my
>language.
>
>The MLT array uses NL_NL for the language key. The szLanguage variable of
>the MLT object is nl-NL. So I had to manually override it in order to get
>it to work:
>
>$oMLT->szLanguage ='NL_NL';
>
>  
>
See below point 2.


More information about the Chameleon mailing list