i18nService
Summary
Defines an internationalization service to manage string translations.
Item Index
Methods
addDictionary
Syntax
Summary
Adds a new dictionary, to the translation table, for the current language. A dictionary is referenced by its name and contains a JSON representation of all its translations. If dictionary does not exist yet, get it from the server.
Parameters:
Returns:
The promise to retrieve the dictionary
destroy
Syntax
destroy
()
Summary
Destroys I18nService cached data.
getDictionary
Syntax
Summary
Gets a dictionary with all its languages or just for the specific language.
Returns:
The translations contained in the dictionary
getLanguage
Syntax
Summary
Gets current language.
Returns:
The current language country code (e.g en-US)
getLanguageName
Syntax
Summary
Gets full name of a language by its code.
Parameters:
-
language
StringThe language code
Returns:
The language full name
getLanguages
Syntax
Summary
Gets supported languages.
Returns:
The list of supported languages
isLanguageSupported
Syntax
Summary
Tests if a language is supported.
Parameters:
-
language
StringThe language code to test
Returns:
true if supported, false otherwise
removeDictionary
Syntax
removeDictionary
-
name
Summary
Removes a dictionary from cache.
Parameters:
-
name
StringThe dictionary name
setLanguage
Syntax
setLanguage
-
language
Summary
Sets current language.
Parameters:
-
language
StringThe current language country code (e.g en-CA)