[OpenLayers-Dev] tips for using i18n

Mike Adair madair at dmsolutions.ca
Mon Mar 10 09:26:21 EDT 2008


There used to be an i18n example file but perhaps that didn't make it to 
trunk.  In any case, you can do this by just extending the 
OpenLayers.Lang class, something like:

        var myStrings = {
          en: {
            myTest: 'these are user defined strings',
            myTemplate: 'language code currently set to {0}'
          },
          fr: {
            myTest: 'ceci est du text different: pardon mon français',
            myTemplate: 'code de langage est fixé à {0}'
          }
        }
        OpenLayers.Util.extend(OpenLayers.Lang, myStrings);
       
Mike

Bart van den Eijnden (OSGIS) wrote:
> Hi list,
>
> I am trying to use the OpenLayers i18n framework in my own application. How
> can this be done? I.e. add extra strings to the dictionary.
>
> I want to keep the strings outside of the OL dictionaries, but since the
> code in Lang.js seems to be very tied to OpenLayers.Lang this seems hard
> without copying too much code.
>
> Thoughts appreciated.
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
>   



More information about the Dev mailing list