Describes utilities in the Javascript API to manage internationalization.
sys.i18n
This package contains methods to work with the internationalization. These objects are stored as metadata using builder.
translate(key, params)
Returns he translated value for the given key
.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
key |
|
yes |
The key of the value to translate. |
|
params |
|
no |
Additional parameters in case the translation contains placeholders. This placeholders must respecto this structure ``. |
Returns
string
- The translated value for the given key in the language of current user, platform language or english. If key does not exist it will return an empty string.
Samples
// gets a translation for a key
var resolved = sys.i18n.translate('key1');
log('key1: '+resolved);
// gets a translation for a key
//key2 could be "There are {{ numberOfItems }} in {{collName}}"
var resolved = sys.i18n.translate('key2'. {numberOfItems: 5, collName:'entities'});
log('key2: '+resolved);