コード例 #1
0
ファイル: loader.js プロジェクト: DangerTweaker/MediaXiko
  return getBestLocale(rootURI).then(function (bestMatchingLocale) {
    // It may be null if the addon doesn't have any locale file
    if (!bestMatchingLocale)
      return resolve(null);

    let localeURI = rootURI + "locale/" + bestMatchingLocale + ".json";

    // Locale files only contains one big JSON object that is used as
    // an hashtable of: "key to translate" => "translated key"
    // TODO: We are likely to change this in order to be able to overload
    //       a specific key translation. For a specific package, module or line?
    return parseJsonURI(localeURI).then(function (json) {
      return {
        hash: json,
        bestMatchingLocale: bestMatchingLocale
      };
    });
  });
コード例 #2
0
ファイル: loader.js プロジェクト: DangerTweaker/MediaXiko
 request.onload = function () {
   resolve(request.responseText);
 }