Service to handle internationalization in the application
Methods
# async inner getLocale() → {Promise.<LocaleSimple>}
Gets the current locale of the application
locale
Promise.<LocaleSimple>
# async inner getLocales(segmentationValueopt) → {Promise.<Array.<localeModel>>}
Get all the available locales for the application
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
segmentationValue |
string
|
<optional> |
optional segment to get a different config |
All the available locales
Promise.<Array.<localeModel>>
# inner getTranslation(key, options) → {String}
Gets the translation, with the interpolation done based on the options
Parameters:
Name | Type | Description |
---|---|---|
key |
String
|
the key to get translation from |
options |
any
|
the options for the interpolation |
the proper value for the provided key
String
# async inner init(segmentationValueopt) → {Promise.<LocaleSimple>}
Initialize the internationalization Service, getting locales, dictionary and directionality and setting the initial one
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
segmentationValue |
string
|
<optional> |
optional segment to get a different config |
a promise that will resolve when the i18n system is ready with the Locale(code and dir)
Promise.<LocaleSimple>
# async inner setLocale(localeCode, segmentationValueopt) → {Promise.<LocaleSimple>}
Set the current locale of the application to the one of the provided code It will request the locale info if needed
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
localeCode |
String
|
ISO locale Code to use |
|
segmentationValue |
string
|
<optional> |
optional segment to get a different config |
A promise with the status of the operation including code and dir
Promise.<LocaleSimple>
Type Definitions
# LocaleSimple
Properties:
Name | Type | Description |
---|---|---|
code |
String
|
ISO locale code |
dir |
String.<('lrt'|'rtl')>
|
directionallity between rtl and ltr |