Bug 1437583 - Split plural forms for Delete/Add bookmarks in separate strings
Since the number of tabs is not actually displayed, having two separate strings from 1 vs many is preferable.
MozReview-Commit-ID: y1dgvsCxmC
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -615,25 +615,26 @@ PlacesController.prototype = {
openContainerInTabsItem.disabled = true;
// Ensure that we don't display the menu if nothing is enabled:
usableItemCount--;
}
}
}
}
- // Make sure correct PluralForms are diplayed when multiple pages are selected.
- var deleteHistoryItem = document.getElementById("placesContext_delete_history");
- deleteHistoryItem.label = PlacesUIUtils.getPluralString("cmd.deletePages.label",
- metadata.length);
- deleteHistoryItem.accessKey = PlacesUIUtils.getString("cmd.deletePages.accesskey");
- var createBookmarkItem = document.getElementById("placesContext_createBookmark");
- createBookmarkItem.label = PlacesUIUtils.getPluralString("cmd.bookmarkPages.label",
- metadata.length);
- createBookmarkItem.accessKey = PlacesUIUtils.getString("cmd.bookmarkPages.accesskey");
+ // Make sure to display the correct string when multiple pages are selected.
+ let stringId = metadata.length === 1 ? "SinglePage" : "MultiplePages";
+
+ let deleteHistoryItem = document.getElementById("placesContext_delete_history");
+ deleteHistoryItem.label = PlacesUIUtils.getString(`cmd.delete${stringId}.label`);
+ deleteHistoryItem.accessKey = PlacesUIUtils.getString(`cmd.delete${stringId}.accesskey`);
+
+ let createBookmarkItem = document.getElementById("placesContext_createBookmark");
+ createBookmarkItem.label = PlacesUIUtils.getString(`cmd.bookmark${stringId}.label`);
+ createBookmarkItem.accessKey = PlacesUIUtils.getString(`cmd.bookmark${stringId}.accesskey`);
return usableItemCount > 0;
},
/**
* Select all links in the current view.
*/
selectAll: function PC_selectAll() {
--- a/browser/locales/en-US/chrome/browser/places/places.properties
+++ b/browser/locales/en-US/chrome/browser/places/places.properties
@@ -78,25 +78,30 @@ OrganizerQueryTags=Tags
# to users with screen readers
# See createResultLabel() in urlbarBindings.xml
tagResultLabel=Tag
bookmarkResultLabel=Bookmark
switchtabResultLabel=Tab
keywordResultLabel=Keyword
searchengineResultLabel=Search
-
# LOCALIZATION NOTE (lockPrompt.text)
# %S will be replaced with the application name.
lockPrompt.title=Browser Startup Error
lockPrompt.text=The bookmarks and history system will not be functional because one of %S’s files is in use by another application. Some security software can cause this problem.
lockPromptInfoButton.label=Learn More
lockPromptInfoButton.accessKey=L
-# LOCALIZATION NOTE (deletePagesLabel): Semi-colon list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-cmd.deletePages.label=Delete Page;Delete Pages
-cmd.deletePages.accesskey=D
+# LOCALIZATION NOTE (cmd.deleteSinglePage.accesskey,
+# cmd.deleteMultiplePages.accesskey): these accesskeys can use the same
+# character, since they're never displayed at the same time
+cmd.deleteSinglePage.label=Delete Page
+cmd.deleteSinglePage.accesskey=D
+cmd.deleteMultiplePages.label=Delete Pages
+cmd.deleteMultiplePages.accesskey=D
-# LOCALIZATION NOTE (bookmarkPagesLabel): Semi-colon list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-cmd.bookmarkPages.label=Bookmark Page;Bookmark Pages
-cmd.bookmarkPages.accesskey=B
+# LOCALIZATION NOTE (cmd.bookmarkSinglePage.accesskey,
+# cmd.bookmarkMultiplePages.accesskey): these accesskeys can use the same
+# character, since they're never displayed at the same time
+cmd.bookmarkSinglePage.label=Bookmark Page
+cmd.bookmarkSinglePage.accesskey=B
+cmd.bookmarkMultiplePages.label=Bookmark Pages
+cmd.bookmarkMultiplePages.accesskey=B