Set the current locale.
Default is 'en'.
$.li18n.currentLocale = 'de';Set the translations.
Default is {}.
$.li18n.translations = {en: {greeing: 'Hello %{{name}}'}};Translates the given key using interpolation options.
Params:
- key - translation lookup key (
String). - interpolationOptions - options for translations with interpolation (
Object).
Returns:
- translation (
String) if found. - error message (
String) if translation not found and$.li18n.onTranslationMissingis set to'message'. - value from
$.li18n.onTranslationMissingif translation not found and$.li18n.onTranslationMissingis set to a function. - throws an error if translation is not found and
$.li18n.onTranslationMissingis not set.
$.li18n.translate('greeting', {name: 'Alice'});
// => 'Hello Alice!'