Dictionary
Kind: global interface
- Dictionary
- .init(config)
- .getLanguage() ⇒
string
- .get(key, [parameters]) ⇒
string
- .has(key) ⇒
boolean
dictionary.init(config)
Initializes this dictionary with the provided language and localization phrases.
Kind: instance method of Dictionary
Param | Type | Description |
---|---|---|
config | Object.<string, \*> |
The dictionary configuration. |
config.$Language | string |
The language property is an ISO 639-1 language code specifying the language of the provided phrases. |
config.dictionary | \* |
The dictionary property contains the localization phrases organized in an implementation-specific way. |
dictionary.getLanguage() ⇒ string
Returns the ISO 639-1 language code of the language this dictionary was initialized with.
Kind: instance method of Dictionary
Returns: string
- The language code representing the language of the
localization phrases in this dictionary.
dictionary.get(key, [parameters]) ⇒ string
Retrieves the localization phrase identified by the specified key, evaluates the phrase’s placeholder expressions using the provided parameters and returns the result.
Kind: instance method of Dictionary
Returns: string
- The specified localization phrase with its placeholders
evaluated using the provided parameters.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the localization phrase. |
[parameters] | Object.<string, (boolean\|number\|string\|Date)> |
The map of parameter names to the parameter values to use. Defaults to an empty plain object. |
dictionary.has(key) ⇒ boolean
Tests whether the specified localization phrase exists in the dictionary.
Kind: instance method of Dictionary
Returns: boolean
- true
if the key exists and denotes a single
localization phrase, otherwise false
.
Param | Type | Description |
---|---|---|
key | string |
The key identifying the localization phrase. |