[OpenLayers-Dev] status of translation possibilities

Tim Schaub tschaub at openplans.org
Fri Oct 19 12:53:52 EDT 2007


Or we could do like others and give elements that contain strings that 
need translating a unique attribute.

Simplified, this could look something like this:

<span i18n="foo">foo in my lang</span>

Then, switching languages would comb through all elements on the page, 
replacing the content of those with i18n attributes - determining the 
appropriate content based on the global lang setting and the value of 
the key in the appropriate dictionary.

Not efficient, but simple.

Tim

PS - I don't think we should go too heavy here because I think OL as a 
mapping library should contain very few strings if any.  How can we get 
strings out of the library you ask?  Use templates to make things like 
the layer switcher - instead of cramming a bunch of text node creation 
code in the controls.

Paul Spencer wrote:
> On 18-Oct-07, at 2:31 PM, Christopher Schmidt wrote:
> 
>> setLanguage, if we're going to provide a method for it, is going to  
>> need
>> to be more complex than that. We'd have to loop through the controls,
>> and call redraw() on them, to update their text, and I'm not sure that
>> all controls would support a redraw correctly.
>>
> 
> Could we use an event that is triggered and then controls that have  
> strings can register (or be registered) for the language changing?
> 
> OpenLayers.String.events.register('languagechange',  
> OpenLayers.Function.bind(this, this.onLanguageChange));
> 
> Then it is a matter of implementing support in specific controls that  
> need it or can use it.  And if there are things other than controls  
> that can use the current language, they can take advantage easily.   
> For instance, some layer types might be able to use the current  
> language for labeling.  And applications (or application frameworks)  
> around OpenLayers could also take advantage of it.
> 
> We will probably want a LanguageSwitcher control that sets the  
> language and tracks the current language too, mostly for testing and  
> development.
> 
> We need a way of indicating what languages to support in any given  
> application, and of enumerating the supported languages through the  
> OpenLayers API.
> 
> We need a way to extend the base set of translations with other,  
> application-specific translations.
> 
> Cheers
> 
> Paul
> 
> +-----------------------------------------------------------------+
> |Paul Spencer                          pspencer at dmsolutions.ca    |
> +-----------------------------------------------------------------+
> |Chief Technology Officer                                         |
> |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
> +-----------------------------------------------------------------+
> 
> 
> 
> 
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> !DSPAM:4033,4717b81f246325210051143!
> 




More information about the Dev mailing list