Bug 940116 - part 1 of many, fix Australis' customize/quit/help labels, r=jaws

This commit is contained in:
Gijs Kruitbosch
2014-01-29 17:10:14 +00:00
parent 9fad3ee19c
commit 4c0b36312f
6 changed files with 44 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
browser.jar: browser.jar:
content/browser/customizableui/aboutCustomizing.xhtml content/browser/customizableui/aboutCustomizing.xhtml
content/browser/customizableui/panelUI.css content/browser/customizableui/panelUI.css
content/browser/customizableui/panelUI.js * content/browser/customizableui/panelUI.js
content/browser/customizableui/panelUI.xml content/browser/customizableui/panelUI.xml
content/browser/customizableui/toolbar.xml content/browser/customizableui/toolbar.xml

View File

@@ -22,19 +22,23 @@
<hbox id="PanelUI-footer-inner"> <hbox id="PanelUI-footer-inner">
<toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;" <toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;"
exitLabel="&appMenuCustomizeExit.label;" exitLabel="&appMenuCustomizeExit.label;"
tooltiptext="&appMenuCustomize.tooltip;"
exitTooltiptext="&appMenuCustomizeExit.tooltip;"
oncommand="gCustomizeMode.toggle();"/> oncommand="gCustomizeMode.toggle();"/>
<toolbarseparator/> <toolbarseparator/>
<toolbarbutton id="PanelUI-help" label="&helpMenu.label;" <toolbarbutton id="PanelUI-help" label="&helpMenu.label;"
tooltiptext="&helpMenu.label;" tooltiptext="&appMenuHelp.tooltip;"
oncommand="PanelUI.showHelpView(this.parentNode);"/> oncommand="PanelUI.showHelpView(this.parentNode);"/>
<toolbarseparator/> <toolbarseparator/>
<toolbarbutton id="PanelUI-quit" <toolbarbutton id="PanelUI-quit"
#ifdef XP_WIN #ifdef XP_WIN
label="&quitApplicationCmdWin.label;" label="&quitApplicationCmdWin.label;"
tooltiptext="&quitApplicationCmdWin.label;" #else
#ifdef XP_MACOSX
label="&quitApplicationCmdMac.label;"
#else #else
label="&quitApplicationCmd.label;" label="&quitApplicationCmd.label;"
tooltiptext="&quitApplicationCmd.label;" #endif
#endif #endif
command="cmd_quitApplication"/> command="cmd_quitApplication"/>
</hbox> </hbox>

View File

@@ -8,6 +8,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ScrollbarSampler",
"resource:///modules/ScrollbarSampler.jsm"); "resource:///modules/ScrollbarSampler.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise", XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm"); "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. * Maintains the state and dispatches events for the main menu panel.
*/ */
@@ -236,6 +238,7 @@ const PanelUI = {
this.endBatchUpdate(); this.endBatchUpdate();
} }
} }
this._updateQuitTooltip();
this.panel.hidden = false; this.panel.hidden = false;
}.bind(this)).then(null, Cu.reportError); }.bind(this)).then(null, Cu.reportError);
@@ -422,7 +425,26 @@ const PanelUI = {
_onHelpViewHide: function(aEvent) { _onHelpViewHide: function(aEvent) {
this.removeEventListener("command", PanelUI); 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
},
}; };
/** /**

View File

@@ -174,6 +174,8 @@ CustomizeMode.prototype = {
let customizeButton = document.getElementById("PanelUI-customize"); let customizeButton = document.getElementById("PanelUI-customize");
customizeButton.setAttribute("enterLabel", customizeButton.getAttribute("label")); customizeButton.setAttribute("enterLabel", customizeButton.getAttribute("label"));
customizeButton.setAttribute("label", customizeButton.getAttribute("exitLabel")); customizeButton.setAttribute("label", customizeButton.getAttribute("exitLabel"));
customizeButton.setAttribute("enterTooltiptext", customizeButton.getAttribute("tooltiptext"));
customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("exitTooltiptext"));
this._transitioning = true; this._transitioning = true;
@@ -325,6 +327,8 @@ CustomizeMode.prototype = {
let customizeButton = document.getElementById("PanelUI-customize"); let customizeButton = document.getElementById("PanelUI-customize");
customizeButton.setAttribute("exitLabel", customizeButton.getAttribute("label")); customizeButton.setAttribute("exitLabel", customizeButton.getAttribute("label"));
customizeButton.setAttribute("label", customizeButton.getAttribute("enterLabel")); 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 // We have to use setAttribute/removeAttribute here instead of the
// property because the XBL property will be set later, and right // property because the XBL property will be set later, and right

View File

@@ -336,12 +336,15 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY showAllHistoryCmd.commandkey "H"> <!ENTITY showAllHistoryCmd.commandkey "H">
<!ENTITY appMenuCustomize.label "Customize"> <!ENTITY appMenuCustomize.label "Customize">
<!ENTITY appMenuCustomize.tooltip "Customize the Menu and Toolbars">
<!ENTITY appMenuCustomizeExit.label "Exit Customize"> <!ENTITY appMenuCustomizeExit.label "Exit Customize">
<!ENTITY appMenuCustomizeExit.tooltip "Finish Customizing">
<!ENTITY appMenuHistory.label "History"> <!ENTITY appMenuHistory.label "History">
<!ENTITY appMenuHistory.showAll.label "Show All History"> <!ENTITY appMenuHistory.showAll.label "Show All History">
<!ENTITY appMenuHistory.clearRecent.label "Clear Recent History…"> <!ENTITY appMenuHistory.clearRecent.label "Clear Recent History…">
<!ENTITY appMenuHistory.restoreSession.label "Restore Previous Session"> <!ENTITY appMenuHistory.restoreSession.label "Restore Previous Session">
<!ENTITY appMenuHistory.viewSidebar.label "View History Sidebar"> <!ENTITY appMenuHistory.viewSidebar.label "View History Sidebar">
<!ENTITY appMenuHelp.tooltip "Open Help Menu">
<!ENTITY customizeMenu.addToToolbar.label "Add to Toolbar"> <!ENTITY customizeMenu.addToToolbar.label "Add to Toolbar">
<!ENTITY customizeMenu.addToToolbar.accesskey "A"> <!ENTITY customizeMenu.addToToolbar.accesskey "A">

View File

@@ -81,3 +81,9 @@ characterencoding-button.tooltiptext = Character encoding
email-link-button.label = Email Link email-link-button.label = Email Link
email-link-button.tooltiptext = 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)