Bug 1287478 - Use proper plural forms for notification of incoming tabs. r=flod,markh

MozReview-Commit-ID: 2l96yrmoluG

--HG--
extra : transplant_source : %82%C1T%DA%E4%0BO%EF%8D%FF%E1v%08%EAz%27%3B%AD%A4%DA
This commit is contained in:
Edouard Oger 2016-07-18 16:30:52 -07:00
parent 7ea3330190
commit 0f02a1105e
2 changed files with 18 additions and 11 deletions

View File

@ -125,14 +125,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContentSearch",
XPCOMUtils.defineLazyModuleGetter(this, "TabCrashHandler",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
"resource://gre/modules/CrashSubmit.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
}
XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
@ -2482,8 +2481,12 @@ BrowserGlue.prototype = {
} else {
title = bundle.GetStringFromName("tabsArrivingNotification.title");
const tabArrivingBody = URIs.every(URI => URI.clientId == URIs[0].clientId) ?
"tabsArrivingNotification.body" : "tabsArrivingNotificationMultiple.body";
body = bundle.formatStringFromName(tabArrivingBody, [URIs.length, deviceName], 2);
"unnamedTabsArrivingNotification.body" :
"unnamedTabsArrivingNotificationMultiple.body";
body = bundle.GetStringFromName(tabArrivingBody);
body = PluralForm.get(URIs.length, body);
body = body.replace("#1", URIs.length);
body = body.replace("#2", deviceName);
}
const clickCallback = (subject, topic, data) => {

View File

@ -47,9 +47,13 @@ tabArrivingNotification.title = Tab received
tabArrivingNotification.body = “%1$S” has arrived from %2$S.
tabsArrivingNotification.title = Multiple tabs received
# LOCALIZATION NOTE (tabsArrivingNotification.body) %1 is the number of tabs received and %2 is the device name.
tabsArrivingNotification.body = %1$S tabs have arrived from %2$S.
# LOCALIZATION NOTE (tabsArrivingNotificationMultiple.body)
# This string is used in a notification shown when we're opening tab(s) that several devices sent us to display.
# %S is the number of tabs received
tabsArrivingNotificationMultiple.body = %S tabs have arrived from your connected devices.
# LOCALIZATION NOTE (unnamedTabsArrivingNotification.body):
# Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of tabs received and #2 is the device name.
unnamedTabsArrivingNotification.body = #1 tab has arrived from #2.;#1 tabs have arrived from #2.
# LOCALIZATION NOTE (unnamedTabsArrivingNotificationMultiple.body):
# Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of tabs received.
unnamedTabsArrivingNotificationMultiple.body = #1 tab has arrived from your connected devices.;#1 tabs have arrived from your connected devices.