RFC/Internationalization

OpenLayers currently does not support internationalization of interface strings. In the past, we had taken the position that internationalization was premature optimization because we only had a small number of strings. However, observation of the current code shows that there are more than 20 strings in the interface which are English only, and support for translation is probably a good thing.

API

OpenLayers will provide a global setting to control the language in use.

The OpenLayers.String object will have an additional function, translate. Translate will accept a translation key -- a single string which can be used to look up the string -- and any number of additional arguments. If additional arguments are passed, they will be interpolated in the string in order.

The translate function will use the single string as a key into a dictionary of values based on the current language string.

The data structure might look like:

OpenLayers.Strings = {
  'en': {
    'wfs_error': 'WFS Error: %s'
  }, 
  'es': {
    'wfs_error': "Error de WFS: %s'
  }
}

Implementation

Implementation will require looking through existing code for hardcoded strings. Example files are:

These files will need to use the OpenLayers.String.translate() function instead.