diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index c6c355e7e795..cecf1134e467 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -731,7 +731,9 @@ HistoryMenu.prototype = { // populate menu let tabsFragment = RecentlyClosedTabsAndWindowsMenuUtils.getTabsFragment( window, - "menuitem" + "menuitem", + /* aPrefixRestoreAll = */ false, + "menu-history-reopen-all-tabs" ); undoPopup.appendChild(tabsFragment); }, @@ -769,7 +771,9 @@ HistoryMenu.prototype = { // populate menu let windowsFragment = RecentlyClosedTabsAndWindowsMenuUtils.getWindowsFragment( window, - "menuitem" + "menuitem", + /* aPrefixRestoreAll = */ false, + "menu-history-reopen-all-windows" ); undoPopup.appendChild(windowsFragment); }, diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index 023c80e693b5..4dfda096b6fe 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -186,19 +186,23 @@ const CustomizableWidgets = [ let body = document.createXULElement("vbox"); body.className = "panel-subview-body"; body.appendChild(fragment); + let separator = document.createXULElement("toolbarseparator"); let footer; while (--elementCount >= 0) { let element = body.children[elementCount]; - CustomizableUI.addShortcut(element); element.classList.add("subviewbutton"); if (element.classList.contains("restoreallitem")) { footer = element; - element.classList.add("panel-subview-footer"); + element.classList.add( + "subviewbutton-iconic", + "panel-subview-footer-button" + ); } else { element.classList.add("subviewbutton-iconic", "bookmark-item"); } } panelview.appendChild(body); + panelview.appendChild(separator); panelview.appendChild(footer); }, }, diff --git a/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm index b1ee8252da06..0b91578aaa33 100644 --- a/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm +++ b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm @@ -31,7 +31,7 @@ var RecentlyClosedTabsAndWindowsMenuUtils = { * @param aPrefixRestoreAll (defaults to false) * Whether the 'restore all tabs' item is suffixed or prefixed to the list. * If suffixed (the default) a separator will be inserted before it. - * @param aRestoreAllLabel (defaults to "menuRestoreAllTabs.label") + * @param aRestoreAllLabel (defaults to "appmenu-reopen-all-tabs") * Which localizable string to use for the 'restore all tabs' item. * @returns A document fragment with UI items for each recently closed tab. */ @@ -39,7 +39,7 @@ var RecentlyClosedTabsAndWindowsMenuUtils = { aWindow, aTagName, aPrefixRestoreAll = false, - aRestoreAllLabel = "menuRestoreAllTabs.label" + aRestoreAllLabel = "appmenu-reopen-all-tabs" ) { let doc = aWindow.document; let fragment = doc.createDocumentFragment(); @@ -79,7 +79,7 @@ var RecentlyClosedTabsAndWindowsMenuUtils = { * @param aPrefixRestoreAll (defaults to false) * Whether the 'restore all windows' item is suffixed or prefixed to the list. * If suffixed (the default) a separator will be inserted before it. - * @param aRestoreAllLabel (defaults to "menuRestoreAllWindows.label") + * @param aRestoreAllLabel (defaults to "appmenu-reopen-all-windows") * Which localizable string to use for the 'restore all windows' item. * @returns A document fragment with UI items for each recently closed window. */ @@ -87,7 +87,7 @@ var RecentlyClosedTabsAndWindowsMenuUtils = { aWindow, aTagName, aPrefixRestoreAll = false, - aRestoreAllLabel = "menuRestoreAllWindows.label" + aRestoreAllLabel = "appmenu-reopen-all-windows" ) { let closedWindowData = SessionStore.getClosedWindowData(false); let doc = aWindow.document; @@ -146,6 +146,14 @@ var RecentlyClosedTabsAndWindowsMenuUtils = { ancestorPanel.hidePopup(); } }, + + get strings() { + delete this.strings; + return (this.strings = new Localization( + ["branding/brand.ftl", "browser/menubar.ftl", "browser/appmenu.ftl"], + true + )); + }, }; function setImage(aItem, aElement) { @@ -221,12 +229,6 @@ function createEntry( RecentlyClosedTabsAndWindowsMenuUtils._undoCloseMiddleClick ); } - if (aIndex == 0) { - element.setAttribute( - "key", - "key_undoClose" + (aIsWindowsFragment ? "Window" : "Tab") - ); - } aFragment.appendChild(element); } @@ -260,10 +262,16 @@ function createRestoreAllEntry( ) { let restoreAllElements = aDocument.createXULElement(aTagName); restoreAllElements.classList.add("restoreallitem"); + + // We cannot use aDocument.l10n.setAttributes because the menubar label is not + // updated in time and displays a blank string (see Bug 1691553). restoreAllElements.setAttribute( "label", - navigatorBundle.GetStringFromName(aRestoreAllLabel) + RecentlyClosedTabsAndWindowsMenuUtils.strings.formatValueSync( + aRestoreAllLabel + ) ); + restoreAllElements.setAttribute( "oncommand", "for (var i = 0; i < " + diff --git a/browser/locales/en-US/browser/appmenu.ftl b/browser/locales/en-US/browser/appmenu.ftl index a19425fbaf50..0821b95c6fae 100644 --- a/browser/locales/en-US/browser/appmenu.ftl +++ b/browser/locales/en-US/browser/appmenu.ftl @@ -116,6 +116,8 @@ profiler-popup-capture-shortcut = appmenu-manage-history = .label = Manage History +appmenu-reopen-all-tabs = Reopen All Tabs +appmenu-reopen-all-windows = Reopen All Windows ## Help panel appmenu-help-header = diff --git a/browser/locales/en-US/browser/menubar.ftl b/browser/locales/en-US/browser/menubar.ftl index 615c2b825b34..e3104e095a27 100644 --- a/browser/locales/en-US/browser/menubar.ftl +++ b/browser/locales/en-US/browser/menubar.ftl @@ -209,6 +209,8 @@ menu-history-undo-menu = .label = Recently Closed Tabs menu-history-undo-window-menu = .label = Recently Closed Windows +menu-history-reopen-all-tabs = Reopen All Tabs +menu-history-reopen-all-windows = Reopen All Windows ## Bookmarks Menu diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 18e497290ec9..e601538b0218 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -340,11 +340,8 @@ update.downloadAndInstallButton.accesskey=U menuOpenAllInTabs.label=Open All in Tabs # History menu -menuRestoreAllTabs.label=Restore All Tabs -# LOCALIZATION NOTE (menuRestoreAllWindows, menuUndoCloseWindowLabel, menuUndoCloseWindowSingleTabLabel): -# see bug 394759 -menuRestoreAllWindows.label=Restore All Windows # LOCALIZATION NOTE (menuUndoCloseWindowLabel): Semicolon-separated list of plural forms. +# see bug 394759 # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # #1 Window Title, #2 Number of tabs menuUndoCloseWindowLabel=#1 (and #2 other tab);#1 (and #2 other tabs)