зеркало из https://github.com/mozilla/pjs.git
Bug 590283 - Bookmark folder item count should use correct plural forms. r=mak77 f=pike
--HG-- extra : rebase_source : bb512289678a750063890e43ac9a74c5c0c69696
This commit is contained in:
Родитель
9e45f146a2
Коммит
873706a537
|
@ -221,8 +221,9 @@ var gEditItemOverlay = {
|
|||
this._allTags = this._getCommonTags();
|
||||
this._initTextField("tagsField", this._allTags.join(", "), false);
|
||||
this._element("itemsCountText").value =
|
||||
PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
|
||||
[this._itemIds.length]);
|
||||
PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
|
||||
this._itemIds.length,
|
||||
[this._itemIds.length]);
|
||||
}
|
||||
|
||||
// tags selector
|
||||
|
|
|
@ -713,8 +713,8 @@ var PlacesOrganizer = {
|
|||
var itemsCountLabel = document.getElementById("itemsCountText");
|
||||
selectItemDesc.hidden = false;
|
||||
itemsCountLabel.value =
|
||||
PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
|
||||
[aNodeList.length]);
|
||||
PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
|
||||
aNodeList.length, [aNodeList.length]);
|
||||
infoBox.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
@ -743,13 +743,9 @@ var PlacesOrganizer = {
|
|||
}
|
||||
else {
|
||||
selectItemDesc.hidden = false;
|
||||
if (rowCount == 1)
|
||||
itemsCountLabel.value = PlacesUIUtils.getString("detailsPane.oneItem");
|
||||
else {
|
||||
itemsCountLabel.value =
|
||||
PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
|
||||
[rowCount]);
|
||||
}
|
||||
itemsCountLabel.value =
|
||||
PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
|
||||
rowCount, [rowCount]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -50,6 +50,9 @@ var Cu = Components.utils;
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
|
||||
Cu.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
return PlacesUtils;
|
||||
|
@ -79,6 +82,31 @@ var PlacesUIUtils = {
|
|||
return bundle.formatStringFromName(key, params, params.length);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a localized plural string for the specified key name and numeric value
|
||||
* substituting parameters.
|
||||
*
|
||||
* @param aKey
|
||||
* String, key for looking up the localized string in the bundle
|
||||
* @param aNumber
|
||||
* Number based on which the final localized form is looked up
|
||||
* @param aParams
|
||||
* Array whose items will substitute #1, #2,... #n parameters
|
||||
* in the string.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en/Localization_and_Plurals
|
||||
* @return The localized plural string.
|
||||
*/
|
||||
getPluralString: function PUIU_getPluralString(aKey, aNumber, aParams) {
|
||||
let str = PluralForm.get(aNumber, bundle.GetStringFromName(aKey));
|
||||
|
||||
// Replace #1 with aParams[0], #2 with aParams[1], and so on.
|
||||
return str.replace(/\#(\d+)/g, function (matchedId, matchedNumber) {
|
||||
let param = aParams[parseInt(matchedNumber, 10) - 1];
|
||||
return param !== undefined ? param : matchedId;
|
||||
});
|
||||
},
|
||||
|
||||
getString: function PUIU_getString(key) {
|
||||
return bundle.GetStringFromName(key);
|
||||
},
|
||||
|
|
|
@ -59,8 +59,11 @@ saveSearch.inputLabel=Name:
|
|||
saveSearch.inputDefaultText=New Search
|
||||
|
||||
detailsPane.noItems=No items
|
||||
detailsPane.oneItem=One item
|
||||
detailsPane.multipleItems=%S items
|
||||
# LOCALIZATION NOTE (detailsPane.itemsCountLabel): Semi-colon list of plural forms.
|
||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||
# #1 number of items
|
||||
# example: 111 items
|
||||
detailsPane.itemsCountLabel=One item;#1 items
|
||||
|
||||
mostVisitedTitle=Most Visited
|
||||
recentlyBookmarkedTitle=Recently Bookmarked
|
||||
|
|
Загрузка…
Ссылка в новой задаче