[OpenLayers-Dev] status of translation possibilities

Christopher Schmidt crschmidt at metacarta.com
Thu Oct 18 16:01:13 EDT 2007


On Thu, Oct 18, 2007 at 03:46:21PM -0400, 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));

I like this idea. I hadn't thought of it, and it makes sense.

> We will probably want a LanguageSwitcher control that sets the  
> language and tracks the current language too, mostly for testing and  
> development.

I'm not convinced that we need that, but if it gets built as part of
development, it would probably be useful. 

> We need a way of indicating what languages to support in any given  
> application, and of enumerating the supported languages through the  
> OpenLayers API.

for (var key in OpenLayers.Strings.languages) { 
  alert(key);
}  

> We need a way to extend the base set of translations with other,  
> application-specific translations.

OpenLayers.Strings.languages['eng']['My Application String!'] = 'My
application String!';

OpenLayers.Strings.languages['spa']['My Application String!'] = 
'¡String Applicacion de mio!';

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list