Methods
F(item, fmtName) → {string|Array.<string>}
Format given item
Parameters:
Name | Type | Description |
---|---|---|
item |
string | number | Array.<string> | Array.<number> | string, number or array to be translated |
fmtName |
string | name of formatter |
Returns:
- Type
- string | Array.<string>
getLang()
Get current language
L(lang, error, successopt)
Set current language
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lang |
string | locale string | ||
error |
function | call when setting failed | ||
success |
function |
<optional> |
reload | call when setting success |
register(fmtName, func)
Register formatters
Parameters:
Name | Type | Description |
---|---|---|
fmtName |
string | formatter name |
func |
fmtFunction | formatter function |
T(item, interpolations) → {string|Array.<string>}
Translate given string
Parameters:
Name | Type | Description |
---|---|---|
item |
string | Array.<string> | string or array to be translated |
interpolations |
object | interpolations of placeholders in template |
Returns:
- Type
- string | Array.<string>
Type Definitions
fmtFunction(content, lang) → {string}
Parameters:
Name | Type | Description |
---|---|---|
content |
string | number | content to be formatted |
lang |
string | locale string |
Returns:
format result
- Type
- string
getTransFile(lang, resolve) → {string|string}
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
lang |
object |
Properties
|
|||||||||
resolve |
function |
Returns:
-
format result
- Type
- string
-
selected language
- Type
- string
readyCallback(switcher)
Parameters:
Name | Type | Description |
---|---|---|
switcher |
object | the created instance |