You can also use the ExtJS style of managing locale/language settings.
if you look at the ExtJS locale files (ext-lang-XX.js) they change the
default text properties in the component's prototype to a locale specific
string.
in the SimplePrint example, rather than set the properties to the OL i18n
dictionary entry at instantiation, the ExtJS language file would do the
following:
if(GeoExt.ux.SimplePrint){
Ext.apply(GeoExt.ux.SimplePrint.prototype, {
dpiText : <String in your language here>,
rotationText: <String in your language here>,
etc...
})
}
Both approaches have their merits. As GeoExt is dependant on OL then it
seems like there may be some way to take the best parts of both approaches.
Matt Priour
Kestrel Computer Consulting
--------------------------------------------------
From: <[email protected]>
Sent: Tuesday, March 23, 2010 9:15 AM
To: "Alexandre Dube" <[email protected]>
Cc: "GeoEXT Dev" <[email protected]>
Subject: Re: [Dev] GeoExt i18n
> Right, this is possible.
>
> For instance I construct such a widget with:
>
> this.printForm = new GeoExt.ux.SimplePrint({
> hideRotation: true,
> defaults: {width: 200, listWidth: 200},
> layoutText: OpenLayers.i18n("mf.print.layout"),
> dpiText: OpenLayers.i18n("mf.print.dpi"),
> rotationText: OpenLayers.i18n("mf.print.rotation"),
> scaleText: OpenLayers.i18n("mf.print.scale"),
> printText: OpenLayers.i18n("mf.print.print"),
> creatingPdfText: OpenLayers.i18n("mf.print.generatingPDF"),
> ...
>
> and then I use my own language files.
>
> Best regards,
> Bart
>
>> Bart,
>>
>> How does this work ? If I want to use this widget in French, can I
>> load an external lang file or do I need to set these properties to what
>> I want ?
>>
>> Thanks,
>>
>> Alexandre
>>
>>
>> [email protected] wrote:
>>> Hi Alexandre,
>>>
>>> the way it has been done for instance by Andreas in
>>> GeoExt.ux.PrintPreview
>>> is:
>>>
>>> GeoExt.ux.PrintPreview = Ext.extend(Ext.Panel, {
>>>
>>> /* begin i18n */
>>> /** api: config[paperSizeText] ``String`` i18n */
>>> paperSizeText: "Paper size:",
>>> /** api: config[resolutionText] ``String`` i18n */
>>> resolutionText: "Resolution:",
>>> /** api: config[printText] ``String`` i18n */
>>> printText: "Print",
>>> /** api: config[emptyTitleText] ``String`` i18n */
>>> emptyTitleText: "Enter map title here.",
>>> /** api: config[includeLegendText] ``String`` i18n */
>>> includeLegendText: "Include legend?",
>>> /** api: config[emptyCommentText] ``String`` i18n */
>>> emptyCommentText: "Enter comments here.",
>>> /** api: config[creatingPdfText] ``String`` i18n */
>>> creatingPdfText: "Creating PDF...",
>>>
>>> Best regards,
>>> Bart
>>>
>>>
>>>> Hi,
>>>>
>>>> I noticed that there is no lang file in GeoExt but I would need one
>>>> for the plugin I created [1]. I need it for the 'text' property [2] of
>>>> a menu created by the plugin. What should I do ? Should I leave a
>>>> default 'english' value and make it customizable by the user ?
>>>>
>>>> Thanks,
>>>>
>>>> [1] http://trac.geoext.org/ticket/185#comment:8
>>>> [2]
>>>> http://trac.geoext.org/attachment/ticket/185/geoext-tree-plugin.2.patch
>>>> (look for 'i18n' to find the text)
>>>>
>>>> --
>>>> Alexandre Dubé
>>>> Mapgears
>>>> www.mapgears.com
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Alexandre Dubé
>> Mapgears
>> www.mapgears.com
>>
>>
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev