Backed out changeset c381e6fba574 (bug 1046142) for bc1 failures
authorWes Kocher <wkocher@mozilla.com>
Thu, 31 Jul 2014 14:34:09 -0700
changeset 208214 2d266c52e2a5
parent 208213 c381e6fba574
child 208215 33eea1df6465
push id3774
push userkwierso@gmail.com
push date2014-07-31 21:34 +0000
treeherdermozilla-beta@2d266c52e2a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1046142
milestone32.0
backs outc381e6fba574
Backed out changeset c381e6fba574 (bug 1046142) for bc1 failures
browser/components/translation/Translation.jsm
browser/components/translation/translation-infobar.xml
--- a/browser/components/translation/Translation.jsm
+++ b/browser/components/translation/Translation.jsm
@@ -27,18 +27,18 @@ this.Translation = {
   STATE_OFFER: 0,
   STATE_TRANSLATING: 1,
   STATE_TRANSLATED: 2,
   STATE_ERROR: 3,
   STATE_UNAVAILABLE: 4,
 
   serviceUnavailable: false,
 
-  supportedSourceLanguages: ["de", "en", "es", "fr", "ja", "ko", "pt", "ru", "zh"],
-  supportedTargetLanguages: ["de", "en", "es", "fr", "ja", "ko", "pl", "pt", "ru", "tr", "vi", "zh"],
+  supportedSourceLanguages: ["zh", "de", "en", "fr", "ja", "ko", "pt", "ru", "es"],
+  supportedTargetLanguages: ["zh", "de", "en", "fr", "ja", "ko", "pt", "ru", "es"],
 
   _defaultTargetLanguage: "",
   get defaultTargetLanguage() {
     if (!this._defaultTargetLanguage) {
       this._defaultTargetLanguage = Cc["@mozilla.org/chrome/chrome-registry;1"]
                                       .getService(Ci.nsIXULChromeRegistry)
                                       .getSelectedLocale("global")
                                       .split("-")[0];
--- a/browser/components/translation/translation-infobar.xml
+++ b/browser/components/translation/translation-infobar.xml
@@ -160,41 +160,35 @@
       <method name="init">
         <parameter name="aTranslation"/>
         <body>
           <![CDATA[
             this.translation = aTranslation;
             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");
-            let sourceLanguages =
-              sortByLocalizedName(Translation.supportedSourceLanguages);
-            for (let [code, name] of sourceLanguages) {
+            for (let code of Translation.supportedSourceLanguages) {
+              let name = bundle.GetStringFromName(code);
               detectedLanguage.appendItem(name, code);
               fromLanguage.appendItem(name, code);
             }
             detectedLanguage.value = this.translation.detectedLanguage;
 
             // translatedFrom is only set if we have already translated this page.
             if (aTranslation.translatedFrom)
               fromLanguage.value = aTranslation.translatedFrom;
 
-            // Fill the list of supported target languages.
-            let targetLanguages =
-              sortByLocalizedName(Translation.supportedTargetLanguages);
-            for (let [code, name] of targetLanguages)
-              toLanguage.appendItem(name, code);
+            // Fill the list of supporter target languages.
+            let toLanguage = this._getAnonElt("toLanguage");
+            for (let code of Translation.supportedTargetLanguages)
+              toLanguage.appendItem(bundle.GetStringFromName(code), code);
 
             if (aTranslation.translatedTo)
               toLanguage.value = aTranslation.translatedTo;
 
             if (aTranslation.state)
               this.state = aTranslation.state;
           ]]>
         </body>