diff --git a/browser/components/translation/Translation.jsm b/browser/components/translation/Translation.jsm index 8cf6fa89708..afbccac960a 100644 --- a/browser/components/translation/Translation.jsm +++ b/browser/components/translation/Translation.jsm @@ -32,8 +32,8 @@ this.Translation = { serviceUnavailable: false, - supportedSourceLanguages: ["zh", "de", "en", "fr", "ja", "ko", "pt", "ru", "es"], - supportedTargetLanguages: ["zh", "de", "en", "fr", "ja", "ko", "pt", "ru", "es"], + supportedSourceLanguages: ["de", "en", "es", "fr", "ja", "ko", "pt", "ru", "zh"], + supportedTargetLanguages: ["de", "en", "es", "fr", "ja", "ko", "pl", "pt", "ru", "tr", "vi", "zh"], _defaultTargetLanguage: "", get defaultTargetLanguage() { diff --git a/browser/components/translation/translation-infobar.xml b/browser/components/translation/translation-infobar.xml index 0fe2de732e4..1186e448ae3 100644 --- a/browser/components/translation/translation-infobar.xml +++ b/browser/components/translation/translation-infobar.xml @@ -166,12 +166,17 @@ let bundle = Cc["@mozilla.org/intl/stringbundle;1"] .getService(Ci.nsIStringBundleService) .createBundle("chrome://global/locale/languageNames.properties"); + let sortByLocalizedName = function(aList) { + return aList.map(code => [code, bundle.GetStringFromName(code)]) + .sort((a, b) => a[1].localeCompare(b[1])); + }; // Fill the lists of supported source languages. let detectedLanguage = this._getAnonElt("detectedLanguage"); let fromLanguage = this._getAnonElt("fromLanguage"); - for (let code of Translation.supportedSourceLanguages) { - let name = bundle.GetStringFromName(code); + let sourceLanguages = + sortByLocalizedName(Translation.supportedSourceLanguages); + for (let [code, name] of sourceLanguages) { detectedLanguage.appendItem(name, code); fromLanguage.appendItem(name, code); } @@ -183,8 +188,10 @@ // Fill the list of supported target languages. let toLanguage = this._getAnonElt("toLanguage"); - for (let code of Translation.supportedTargetLanguages) - toLanguage.appendItem(bundle.GetStringFromName(code), code); + let targetLanguages = + sortByLocalizedName(Translation.supportedTargetLanguages); + for (let [code, name] of targetLanguages) + toLanguage.appendItem(name, code); if (aTranslation.translatedTo) toLanguage.value = aTranslation.translatedTo;