[OpenLayers-Dev] tips for using i18n
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Mon Mar 10 10:38:07 EDT 2008
Hey Mike,
that example doesn't work for me against trunk. It overrides all the
existing keys in en and fr.
This does work:
var myEnglishStrings = {
'myTest': "these are user defined strings"
}
OpenLayers.Util.extend(OpenLayers.Lang.en, myEnglishStrings);
Best regards,
Bart
--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl
--------- Oorspronkelijk bericht --------
Van: Mike Adair <madair at dmsolutions.ca>
Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Cc: dev at openlayers.org
Onderwerp: Re: [OpenLayers-Dev] tips for using i18n
Datum: 10/03/08 11:26
> 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