Bug 940116 - part 1 of many, fix Australis' customize/quit/help labels, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 29 Jan 2014 17:10:14 +0000
changeset 165794 9b3dc7c6dae9863ce59b2be44903f86ab1ca7313
parent 165793 288310faa1ffc58829378c26c33c66411812a888
child 165795 bb24d5ea7f897325bb0a043891fb4c3058bb5eec
push id26103
push userryanvm@gmail.com
push dateWed, 29 Jan 2014 20:18:50 +0000
treeherdermozilla-central@90bfbf075f3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs940116
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 940116 - part 1 of many, fix Australis' customize/quit/help labels, r=jaws
browser/components/customizableui/content/jar.mn
browser/components/customizableui/content/panelUI.inc.xul
browser/components/customizableui/content/panelUI.js
browser/components/customizableui/src/CustomizeMode.jsm
browser/locales/en-US/chrome/browser/browser.dtd
browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
--- a/browser/components/customizableui/content/jar.mn
+++ b/browser/components/customizableui/content/jar.mn
@@ -1,11 +1,11 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 browser.jar:
   content/browser/customizableui/aboutCustomizing.xhtml
   content/browser/customizableui/panelUI.css
-  content/browser/customizableui/panelUI.js
+* content/browser/customizableui/panelUI.js
   content/browser/customizableui/panelUI.xml
   content/browser/customizableui/toolbar.xml
 
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -17,29 +17,33 @@
       <footer id="PanelUI-footer">
         <toolbarbutton id="PanelUI-fxa-status" label="&fxaSignIn.label;"
                        oncommand="gFxAccounts.toggle(event);"
                        hidden="true"/>
 
         <hbox id="PanelUI-footer-inner">
           <toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;"
                          exitLabel="&appMenuCustomizeExit.label;"
+                         tooltiptext="&appMenuCustomize.tooltip;"
+                         exitTooltiptext="&appMenuCustomizeExit.tooltip;"
                          oncommand="gCustomizeMode.toggle();"/>
           <toolbarseparator/>
           <toolbarbutton id="PanelUI-help" label="&helpMenu.label;"
-                         tooltiptext="&helpMenu.label;"
+                         tooltiptext="&appMenuHelp.tooltip;"
                          oncommand="PanelUI.showHelpView(this.parentNode);"/>
           <toolbarseparator/>
           <toolbarbutton id="PanelUI-quit"
 #ifdef XP_WIN
                          label="&quitApplicationCmdWin.label;"
-                         tooltiptext="&quitApplicationCmdWin.label;"
+#else
+#ifdef XP_MACOSX
+                         label="&quitApplicationCmdMac.label;"
 #else
                          label="&quitApplicationCmd.label;"
-                         tooltiptext="&quitApplicationCmd.label;"
+#endif
 #endif
                          command="cmd_quitApplication"/>
         </hbox>
       </footer>
     </panelview>
 
     <panelview id="PanelUI-history" flex="1">
       <label value="&appMenuHistory.label;" class="panel-subview-header"/>
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -3,16 +3,18 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
                                   "resource:///modules/CustomizableUI.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ScrollbarSampler",
                                   "resource:///modules/ScrollbarSampler.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
                                   "resource://gre/modules/Promise.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
+                                  "resource://gre/modules/ShortcutUtils.jsm");
 /**
  * Maintains the state and dispatches events for the main menu panel.
  */
 
 const PanelUI = {
   /** Panel events that we listen for. **/
   get kEvents() ["popupshowing", "popupshown", "popuphiding", "popuphidden"],
   /**
@@ -231,16 +233,17 @@ const PanelUI = {
       } else {
         this.beginBatchUpdate();
         try {
           CustomizableUI.registerMenuPanel(this.contents);
         } finally {
           this.endBatchUpdate();
         }
       }
+      this._updateQuitTooltip();
       this.panel.hidden = false;
     }.bind(this)).then(null, Cu.reportError);
 
     return this._readyPromise;
   },
 
   /**
    * Switch the panel to the main view if it's not already
@@ -417,17 +420,36 @@ const PanelUI = {
     }
     items.appendChild(fragment);
 
     this.addEventListener("command", PanelUI);
   },
 
   _onHelpViewHide: function(aEvent) {
     this.removeEventListener("command", PanelUI);
-  }
+  },
+
+  _updateQuitTooltip: function() {
+#ifndef XP_WIN
+#ifdef XP_MACOSX
+    let tooltipId = "quit-button.tooltiptext.mac";
+    let brands = Services.strings.createBundle("chrome://branding/locale/brand.properties");
+    let stringArgs = [brands.GetStringFromName("brandShortName")];
+#else
+    let tooltipId = "quit-button.tooltiptext.linux";
+    let stringArgs = [];
+#endif
+
+    let key = document.getElementById("key_quitApplication");
+    stringArgs.push(ShortcutUtils.prettifyShortcut(key));
+    let tooltipString = CustomizableUI.getLocalizedProperty({x: tooltipId}, "x", stringArgs);
+    let quitButton = document.getElementById("PanelUI-quit");
+    quitButton.setAttribute("tooltiptext", tooltipString);
+#endif
+  },
 };
 
 /**
  * Gets the currently selected locale for display.
  * @return  the selected locale or "en-US" if none is selected
  */
 function getLocale() {
   try {
--- a/browser/components/customizableui/src/CustomizeMode.jsm
+++ b/browser/components/customizableui/src/CustomizeMode.jsm
@@ -169,16 +169,18 @@ CustomizeMode.prototype = {
       // while customizing.
       let mainView = window.PanelUI.mainView;
       let panelHolder = document.getElementById("customization-panelHolder");
       panelHolder.appendChild(mainView);
 
       let customizeButton = document.getElementById("PanelUI-customize");
       customizeButton.setAttribute("enterLabel", customizeButton.getAttribute("label"));
       customizeButton.setAttribute("label", customizeButton.getAttribute("exitLabel"));
+      customizeButton.setAttribute("enterTooltiptext", customizeButton.getAttribute("tooltiptext"));
+      customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("exitTooltiptext"));
 
       this._transitioning = true;
 
       let customizer = document.getElementById("customization-container");
       customizer.parentNode.selectedPanel = customizer;
       customizer.hidden = false;
 
       yield this._doTransition(true);
@@ -320,16 +322,18 @@ CustomizeMode.prototype = {
       this.dispatchToolboxEvent("customizationending");
 
       window.PanelUI.setMainView(window.PanelUI.mainView);
       window.PanelUI.menuButton.disabled = false;
 
       let customizeButton = document.getElementById("PanelUI-customize");
       customizeButton.setAttribute("exitLabel", customizeButton.getAttribute("label"));
       customizeButton.setAttribute("label", customizeButton.getAttribute("enterLabel"));
+      customizeButton.setAttribute("exitTooltiptext", customizeButton.getAttribute("tooltiptext"));
+      customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("enterTooltiptext"));
 
       // We have to use setAttribute/removeAttribute here instead of the
       // property because the XBL property will be set later, and right
       // now we'd be setting an expando, which breaks the XBL property.
       document.getElementById("PanelUI-help").removeAttribute("disabled");
       document.getElementById("PanelUI-quit").removeAttribute("disabled");
 
       // We need to set this._customizing to false before removing the tab
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -331,22 +331,25 @@ These should match what Safari and other
 <!-- LOCALIZATION NOTE (historyUndoWindowMenu): see bug 394759 -->
 <!ENTITY historyUndoWindowMenu.label "Recently Closed Windows">
 <!ENTITY historyRestoreLastSession.label "Restore Previous Session">
 
 <!ENTITY showAllHistoryCmd2.label "Show All History">
 <!ENTITY showAllHistoryCmd.commandkey "H">
 
 <!ENTITY appMenuCustomize.label "Customize">
+<!ENTITY appMenuCustomize.tooltip "Customize the Menu and Toolbars">
 <!ENTITY appMenuCustomizeExit.label "Exit Customize">
+<!ENTITY appMenuCustomizeExit.tooltip "Finish Customizing">
 <!ENTITY appMenuHistory.label "History">
 <!ENTITY appMenuHistory.showAll.label "Show All History">
 <!ENTITY appMenuHistory.clearRecent.label "Clear Recent History…">
 <!ENTITY appMenuHistory.restoreSession.label "Restore Previous Session">
 <!ENTITY appMenuHistory.viewSidebar.label "View History Sidebar">
+<!ENTITY appMenuHelp.tooltip "Open Help Menu">
 
 <!ENTITY customizeMenu.addToToolbar.label "Add to Toolbar">
 <!ENTITY customizeMenu.addToToolbar.accesskey "A">
 <!ENTITY customizeMenu.addToPanel.label "Add to Menu">
 <!ENTITY customizeMenu.addToPanel.accesskey "M">
 <!ENTITY customizeMenu.moveToToolbar.label "Move to Toolbar">
 <!ENTITY customizeMenu.moveToToolbar.accesskey "o">
 <!-- LOCALIZATION NOTE (customizeMenu.moveToPanel.accesskey) can appear on the
--- a/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
+++ b/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
@@ -76,8 +76,14 @@ paste-button.tooltiptext = Paste
 feed-button.label = Subscribe
 feed-button.tooltiptext = Subscribe to this page…
 
 characterencoding-button.label = Character Encoding
 characterencoding-button.tooltiptext = Character encoding
 
 email-link-button.label = Email Link
 email-link-button.tooltiptext = Email Link
+
+# LOCALIZATION NOTE(quit-button.tooltiptext.linux): %S is the keyboard shortcut
+quit-button.tooltiptext.linux = Quit (%S)
+# LOCALIZATION NOTE(quit-button.tooltiptext.mac): %1$S is the brand name (e.g. Firefox),
+# %2$S is the keyboard shortcut
+quit-button.tooltiptext.mac = Quit %1$S (%2$S)