I18nProvider
I18n service to get/set localized strings.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) |
Method Summary
Public Methods | ||
public |
Gets a localized string. |
|
public |
Sets multiple localized strings, using translation hints. |
Public Constructors
Public Members
Public Methods
public get(key: String): String source
Gets a localized string.
Params:
Name | Type | Attribute | Description |
key | String | the key of the string to retrieve |
Example:
Coral.i18n.get('English string'); // => 'Translated String'
public set(map: Array<String, String, String>): * source
Sets multiple localized strings, using translation hints.
Return:
* |
Example:
Coral.i18n.set([
['English string', 'Translated string 1', 'Translation hint 1'],
['English string', 'Translated string 2', 'Translation hint 2'],
['English string with {0} items', 'Translated string 1 with {0} items', 'Translation hint 1'],
['English string with {0} items', 'Translated string 2 with {0} items', 'Translation hint 2'],
['English string with {0}, {1} and {2} items', 'Translated string 1 with {0}, {1} and {2} items', 'Translation hint 1'],
['English string with {0}, {1} and {2} items', 'Translated string 2 with {0}, {1} and {2} items', 'Translation hint 2'],
['English string: {name}', 'Translated string 1: {name}', 'Translation hint 1'],
['English string: {name}', 'Translated string 2: {name}', 'Translation hint 2'],
['English string: {name1}, {name2}, and {name3}', 'Translated string 1: {name3}, {name1}, and {name2}', 'Translation hint 1'],
['English string: {name1}, {name2}, and {name3}', 'Translated string 2: {name3}, {name1}, and {name2}', 'Translation hint 2']
]);