Methods
# addLocale(lang, locales)
Add locales.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string
|
Language to add, in ISO (es_ES) format. |
locales |
Object
|
Object with the key/value pairs for locales. |
# addLocales(obj)
Add an object of locales.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object
|
Language object. Key is the language code. |
# getLang()
Get the language of the user based on one setted by the platform.
# init(forceopt)
Initialize translations
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
force |
string
|
boolean
|
<optional> |
false | Force to passed language. |
# setLang(langopt)
Set the language.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lang |
string
|
<optional> |
'en_US' | Language to force (es_ES, en_US, ...) |
# trans(str, langopt) → {string}
Translate a string to the current locale.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
str |
string
|
String to translate. |
||
lang |
string
|
<optional> |
null | The destination language (Auto if null). |
string