new I18nWrapper()
- Source:
Properties:
Name | Type | Description |
---|---|---|
CK_LOCALE |
string | Configuration key to retrieve the locale code from config.json |
A wrapper for MasteryCLI i18n feature
Extends
- Polyglot
Methods
getLocale(lang) → {string}
- Source:
Retrieve current selected locale from global.conf
Parameters:
Name | Type | Description |
---|---|---|
lang |
string |
Returns:
The default locale
- Type
- string
has(key, lang) → {Boolean}
- Source:
Check if a translation key has its translated message
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The translation key to check |
lang |
string | Language code |
Returns:
Return true if translated message, otherwise return false
- Type
- Boolean
t(key, optionsopt) → {string}
- Source:
- See:
Find the translation message based on translation key and current locale
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | The translation key to translate | ||
options |
Object |
<optional> |
{}
|
The translation variable values if the translated message does have any variable to replace |
Returns:
The translated message if exists, otherwise return its key back
- Type
- string