i18n

i18n

Source:
Version:
  • WebSDK1.8.1

Methods

load(i18n_dict, lang)

Source:

Load translations.

Example
//load customer specific language with myLangauge
  var userLangTemplate = $.i18n.getAll("en-US");
  var userLangDict = Object.assign({}, userLangTemplate, {'apac.toolbar_leave': 'Leave',
                                                          'apac.wc_leave_meeting': '不要会议',
                                                          'apac.wc_joining_meeting': '我在努力中...'});
  $.i18n.load(userLangDict, "myLangauge");
  // or use a json file load language resource
  $.i18n.load("/language-key-value.json", "myLangauge");

//modifiy office language
  var userLangTemplate = $.i18n.getAll("en-US");
  var userLangDict = Object.assign({}, userLangTemplate, {'apac.toolbar_leave': 'Leave',
                                                          'apac.wc_leave_meeting': '不要会议',
                                                          'apac.wc_joining_meeting': '我在努力中...'});
  $.i18n.load(userLangDict, "en-US");
Parameters:
Name Type Description
i18n_dict Object | string

The dictionary to use for translation or json file url LanguageResource

lang languages

language name, could be office supported or assigned by customer

reload(lang)

Source:

Change translations resource. Set a supported language when Joining a meeting.

Example
$.i18n.reload("jp-JP");
Parameters:
Name Type Description
lang languages

change to targeted lang. user lang > office lang > default(en_US), first you need to use load func add customer translation resource

get(str, argsopt) → {string}

Source:

Looks the given string up in the dictionary and returns the translation if one exists. If a translation is not found, returns the original word.

Example
$.i18n.get('apac.toolbar_leave')
Parameters:
Name Type Attributes Description
str language-key-value

The key to translate, it's also get customer's key which loaded.

args string <optional>

the string formate arguments. this args will pass to printf

Returns:

Translated word.

Type
string

printf(str, args) → {string}

Source:

Substitutes %s with parameters given in list. %%s is used to escape %s.

Parameters:
Name Type Description
str string

String to perform printf on.

args string

Array of arguments for printf.

Returns:

Substituted string.

Type
string

getAll(lang) → {Object}

Source:

get current language resource result

Example
//get english language translation resource object
$.i18n.getAll("en-US");

//get japeniese language translation resource object
$.i18n.getAll("jp-JP");
Parameters:
Name Type Description
lang languages

language key

Returns:

language resource result

Type
Object