Bug 1168481 - Add en-* translations to Pocket. r=adw, a=lizzard
authorJustin Dolske <dolske@mozilla.com>
Tue, 09 Jun 2015 15:42:00 -0400
changeset 266229 f137fedd1455
parent 266228 6fe433fed5fb
child 266230 af8d7ef03660
push id4792
push userryanvm@gmail.com
push date2015-06-10 20:30 +0000
treeherdermozilla-beta@f137fedd1455 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, lizzard
bugs1168481
milestone39.0
Bug 1168481 - Add en-* translations to Pocket. r=adw, a=lizzard
browser/app/profile/firefox.js
browser/base/content/browser-places.js
browser/base/content/nsContextMenu.js
browser/components/customizableui/CustomizableWidgets.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1910,9 +1910,9 @@ pref("browser.reader.detectedFirstArticl
 // Don't limit how many nodes we care about on desktop:
 pref("reader.parse-node-limit", 0);
 
 pref("browser.pocket.enabled", true);
 pref("browser.pocket.api", "api.getpocket.com");
 pref("browser.pocket.site", "getpocket.com");
 pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
 pref("browser.pocket.useLocaleList", true);
-pref("browser.pocket.enabledLocales", "en-US de es-ES ja ja-JP-mac ru");
+pref("browser.pocket.enabledLocales", "en-US en-GB en-ZA de es-ES ja ja-JP-mac ru");
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1431,16 +1431,19 @@ let BookmarkingUI = {
   },
 
   updatePocketItemVisibility: function BUI_updatePocketItemVisibility(prefix) {
     let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
     if (!hidden) {
       let locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
                    getService(Ci.nsIXULChromeRegistry).
                    getSelectedLocale("browser");
+      if (locale == "en-GB" || locale == "en-ZA")
+        locale = "en-US";
+
       if (locale != "en-US") {
         if (locale == "ja-JP-mac")
           locale = "ja";
         let url = "chrome://browser/content/browser-pocket-" + locale + ".properties";
         let bundle = Services.strings.createBundle(url);
         let item = document.getElementById(prefix + "pocket");
         try {
           item.setAttribute("label", bundle.GetStringFromName("pocketMenuitem.label"));
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -249,16 +249,19 @@ nsContextMenu.prototype = {
     canPocket = canPocket && (targetURI.schemeIs("http") || targetURI.schemeIs("https") ||
                               (targetURI.schemeIs("about") && ReaderMode.getOriginalUrl(targetURI.spec)));
     canPocket = canPocket && window.gBrowser && this.browser.getTabBrowser() == window.gBrowser;
 
     if (canPocket) {
       let locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
                    getService(Ci.nsIXULChromeRegistry).
                    getSelectedLocale("browser");
+      if (locale == "en-GB" || locale == "en-ZA")
+        locale = "en-US";
+
       if (locale != "en-US") {
         if (locale == "ja-JP-mac")
           locale = "ja";
         let url = "chrome://browser/content/browser-pocket-" + locale + ".properties";
         let bundle = Services.strings.createBundle(url);
         let saveToPocketItem = document.getElementById("context-pocket");
         let saveLinkToPocketItem = document.getElementById("context-savelinktopocket");
         try {
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1099,17 +1099,19 @@ if (Services.prefs.getBoolPref("browser.
       enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
     } catch (ex) {
       Cu.reportError(ex);
     }
     isEnabledForLocale = enabledLocales.indexOf(browserLocale) != -1;
   }
 
   if (isEnabledForLocale) {
-    if (browserLocale == "ja-JP-mac")
+    if (browserLocale == "en-GB" || browserLocale == "en-ZA")
+      browserLocale = "en-US";
+    else if (browserLocale == "ja-JP-mac")
       browserLocale = "ja";
     let url = "chrome://browser/content/browser-pocket-" + browserLocale + ".properties";
     let strings = Services.strings.createBundle(url);
     let label;
     let tooltiptext;
     try {
       label = strings.GetStringFromName("pocket-button.label");
       tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext");