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 }; }); });
request.onload = function () { resolve(request.responseText); }