i18n.js

/**
 * @namespace $.i18n
 * @version WebSDK1.8.3
 */

/**
 * @memberof $.i18n
 * @instance
 * @param {Object} params
 */


/**
 * Load translations.
 * @method load
 * @memberof $.i18n
 * @instance
 * @param {Object | string} i18n_dict - The dictionary to use for translation or json file url LanguageResource
 * @param {languages} lang - language name, could be office supported or assigned by customer
 * @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");

 *
 */


/**
 * Change translations resource. Set a supported language when Joining a meeting.
 * @method reload
 * @memberof $.i18n
 * @instance
 * @param {languages} lang - change to targeted lang. user lang > office lang > default(en_US), first you need to use load func add customer translation resource
 * @example
 * $.i18n.reload("jp-JP");
 */


/**
 * 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.
 * @memberof $.i18n
 * @method get
 * @instance
 * @param {language-key-value} str - The key to translate, it's also get customer's key which loaded.
 * @param {string} [args] - the string formate arguments. this args will pass to printf
 * @return {string} Translated word.
 * @example
 * $.i18n.get('apac.toolbar_leave')
 */


/**
 * Substitutes %s with parameters given in list. %%s is used to escape %s.
 * @method printf
 * @memberof $.i18n
 * @instance
 * @param {string} str - String to perform printf on.
 * @param {string} args - Array of arguments for printf.
 * @return {string} Substituted string.
 */


/**
 * get current language resource result
 * @method getAll
 * @memberof $.i18n
 * @instance
 * @param {languages} lang language key
 * @return {Object} language resource result
 * @example
 *
  //get english language translation resource object
 * $.i18n.getAll("en-US");
 *
//get japeniese language translation resource object
 * $.i18n.getAll("jp-JP");
 */