Skip to end of metadata
Go to start of metadata

Language

 

Localization_language library's Language constructor that creates an object used for translating strings. After the object is created, it checks the phone's lang/locale settings and attempts to load any localized string files available. For example, if the phone's locale is set to es_mx (Spanish/Mexico), the Language constructor checks the app's directory for a 'strings-es_mx.js' file and attempts to load language keys from this file. For more information about creating localized apps see Building Localized Apps in the Guides section.

Additionally, the phone's lang/locale settings can be overridden when creating the Language object by passing a langLocale string to the constructor.


Require Extended Library: 

 

 

 

Class Constructor


new Language()

Creates a new Language object.

 

Initialization Parameters

 

NameRequiredTypeDefaultDescription
langLocale
No
string
en_us

Lang/locale code to use when loading string localization files. The standard format for this string is [lang code]_[locale code] (e.g., es_mx for Spanish/Mexico, en_us for English/US). The lang/locale code corresponds to the last part of a localization file's name (e.g., strings-en_us.js contains the translated strings for English/US).

defaultLangLocale
No
string
en_us

Indicates the language file to use if the app does not have a language file for the phone's chosen language. For example, if the chosen language/locale is fr_fr, but the app does not include the file strings.fr_fr.js, then the app uses the default language file as indicated with this parameter. If no value has been defined, the phone tries to use en_us.

Icon

The functionality of this object is included in the  app extended library . It is recommended you use the app library if you wish to use this feature. 

 

Methods

Name Description 
translate

Look up a language key and test it against the currently specificed language.

  • No labels