Bug 1164407 - Pocket not enabled on ja builds under Mac OS X. r=adw a=dolske
authorJustin Dolske <dolske@mozilla.com>
Wed, 13 May 2015 20:44:53 -0700
changeset 260494 99ea3c3c13f6
parent 260493 48eaac80d6b5
child 260495 f724af08988f
push id799
push userjdolske@mozilla.com
push date2015-05-14 03:46 +0000
treeherdermozilla-release@11c4678a21bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, dolske
bugs1164407
milestone38.0.1
Bug 1164407 - Pocket not enabled on ja builds under Mac OS X. r=adw a=dolske
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
@@ -1900,9 +1900,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 ru");
+pref("browser.pocket.enabledLocales", "en-US de es-ES ja ja-JP-mac ru");
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1432,16 +1432,18 @@ 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-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"));
         } catch (err) {
           // GetStringFromName throws when the bundle doesn't exist.  In that
           // case, the item will retain the browser-pocket.dtd en-US string that
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -237,16 +237,18 @@ nsContextMenu.prototype = {
         CustomizableUI.getPlacementOfWidget("pocket-button") &&
         (uri.schemeIs("http") || uri.schemeIs("https") ||
          (uri.schemeIs("about") && ReaderMode.getOriginalUrl(uri.spec)));
       if (canPocket) {
         let locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
                      getService(Ci.nsIXULChromeRegistry).
                      getSelectedLocale("browser");
         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("context-pocket");
           try {
             item.setAttribute("label", bundle.GetStringFromName("saveToPocketCmd.label"));
             item.setAttribute("accesskey", bundle.GetStringFromName("saveToPocketCmd.accesskey"));
           } catch (err) {
             // GetStringFromName throws when the bundle doesn't exist.  In that
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1073,16 +1073,18 @@ 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")
+      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");
     } catch (err) {