Bug 853126 - Use PluralForm for the blocked popup warning on desktop [r=dao]

This commit is contained in:
Matt Brubeck 2013-03-22 15:27:25 -07:00
parent 4ffd405d44
commit aa734e5007
2 changed files with 7 additions and 7 deletions

View File

@ -416,7 +416,6 @@ var gPopupBlockerObserver = {
if (gPrefService.getBoolPref("privacy.popups.showBrowserMessage")) {
var brandBundle = document.getElementById("bundle_brand");
var brandShortName = brandBundle.getString("brandShortName");
var message;
var popupCount = gBrowser.pageReport.length;
#ifdef XP_WIN
var popupButtonText = gNavigatorBundle.getString("popupWarningButton");
@ -425,10 +424,10 @@ var gPopupBlockerObserver = {
var popupButtonText = gNavigatorBundle.getString("popupWarningButtonUnix");
var popupButtonAccesskey = gNavigatorBundle.getString("popupWarningButtonUnix.accesskey");
#endif
if (popupCount > 1)
message = gNavigatorBundle.getFormattedString("popupWarningMultiple", [brandShortName, popupCount]);
else
message = gNavigatorBundle.getFormattedString("popupWarning", [brandShortName]);
var messageBase = gNavigatorBundle.getString("popupWarning.message");
var message = PluralForm.get(popupCount, messageBase)
.replace("#1", brandShortName)
.replace("#2", popupCount);
var notificationBox = gBrowser.getNotificationBox();
var notification = notificationBox.getNotificationWithValue("popup-blocked");

View File

@ -84,8 +84,9 @@ lwthemeNeedsRestart.message=%S will be installed after you restart.
lwthemeNeedsRestart.button=Restart Now
lwthemeNeedsRestart.accesskey=R
popupWarning=%S prevented this site from opening a pop-up window.
popupWarningMultiple=%S prevented this site from opening %S pop-up windows.
# LOCALIZATION NOTE (popupWarning.message): Semicolon-separated list of plural forms.
# #1 is brandShortName and #2 is the number of pop-ups blocked.
popupWarning.message=#1 prevented this site from opening a pop-up window.;#1 prevented this site from opening #2 pop-up windows.
popupWarningButton=Options
popupWarningButton.accesskey=O
popupWarningButtonUnix=Preferences