Internationalization namespace. Contains dictionaries in various languages and methods to set and get the current language.
OpenLayers.Lang | Internationalization namespace. |
Properties | |
defaultCode | {String} Default language to use when a specific language can’t be found. |
Functions | |
getCode | Get the current language code. |
setCode | Set the language code for string translation. |
translate | Looks up a key from a dictionary based on the current language string. |
OpenLayers.i18n | Alias for OpenLayers.Lang.translate. |
setCode: function( code )
Set the language code for string translation. This code is used by the OpenLayers.Lang.translate method.
Parameters- code - {String} These codes follow the IETF recommendations at http://www.ietf.org/rfc/rfc3066.txt. If no value is set, the browser’s language setting will be tested. If no OpenLayers.Lang dictionary exists for the code, the <OpenLayers.String.defaultLang> will be used.
translate: function( key, context )
Looks up a key from a dictionary based on the current language string. The value of getCode will be used to determine the appropriate dictionary. Dictionaries are stored in OpenLayers.Lang.
key | {String} The key for an i18n string value in the dictionary. |
context | {Object} Optional context to be used with OpenLayers.String.format. |
{String} A internationalized string.
Alias for OpenLayers.Lang.translate. Looks up a key from a dictionary based on the current language string. The value of OpenLayers.Lang.getCode will be used to determine the appropriate dictionary. Dictionaries are stored in OpenLayers.Lang.
key | {String} The key for an i18n string value in the dictionary. |
context | {Object} Optional context to be used with OpenLayers.String.format. |
{String} A internationalized string.
Get the current language code.
getCode: function()
Set the language code for string translation.
setCode: function( code )
Looks up a key from a dictionary based on the current language string.
translate: function( key, context )
Given a string with tokens in the form ${token}, return a string with tokens replaced with properties from the given context object.
format: function( template, context, args )