Bug 1199609 - Expose keyboard shortcut for closing the current tab in the tab's close button tooltip. r=jaws

This commit is contained in:
Dão Gottwald 2015-08-29 11:10:06 +02:00
parent 788cbcdafe
commit 0e2d227441
2 changed files with 15 additions and 5 deletions

View File

@ -3945,16 +3945,23 @@
event.preventDefault();
return;
}
let stringWithShortcut = (stringId, keyElemId) => {
let keyElem = document.getElementById(keyElemId);
let shortcut = ShortcutUtils.prettifyShortcut(keyElem);
return this.mStringBundle.getFormattedString(stringId, [shortcut]);
};
var label;
if (tab.mOverCloseButton) {
label = this.mStringBundle.getString("tabs.closeTab.tooltip");
label = tab.selected ?
stringWithShortcut("tabs.closeSelectedTab.tooltip", "key_close") :
this.mStringBundle.getString("tabs.closeTab.tooltip");
} else if (tab._overPlayingIcon) {
var stringID = tab.linkedBrowser.audioMuted ?
let stringID = tab.linkedBrowser.audioMuted ?
"tabs.unmuteAudio.tooltip" :
"tabs.muteAudio.tooltip";
var key = document.getElementById("key_toggleMute");
var shortcut = ShortcutUtils.prettifyShortcut(key);
label = this.mStringBundle.getFormattedString(stringID, [shortcut]);
label = stringWithShortcut(stringID, "key_toggleMute");
} else {
label = tab.getAttribute("label") +
(this.AppConstants.E10S_TESTING_ONLY && tab.linkedBrowser && tab.linkedBrowser.isRemoteBrowser ? " - e10s" : "");

View File

@ -31,6 +31,9 @@ tabs.closeButtonMultiple=Close tabs
tabs.closeWarningPromptMe=Warn me when I attempt to close multiple tabs
tabs.closeTab.tooltip=Close tab
# LOCALIZATION NOTE (tabs.closeSelectedTab.tooltip):
# %S is the keyboard shortcut for closing the current tab
tabs.closeSelectedTab.tooltip=Close tab (%S)
# LOCALIZATION NOTE (tabs.muteAudio.tooltip):
# %S is the keyboard shortcut for "Mute tab"
tabs.muteAudio.tooltip=Mute tab (%S)