Bug 570957 - Use PluralForm for Sync Strings (additionalClients.label and friends), r=mconnor, a=blocking2.0 beta6+

This commit is contained in:
Vlado Valastiak 2010-09-10 22:02:57 +02:00
parent 2a945c237a
commit 51331905b7
2 changed files with 30 additions and 11 deletions

View File

@ -58,6 +58,7 @@ const SETUP_SUCCESS_PAGE = 8;
Cu.import("resource://services-sync/main.js"); Cu.import("resource://services-sync/main.js");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/PluralForm.jsm");
var gSyncSetup = { var gSyncSetup = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
@ -718,7 +719,9 @@ var gSyncSetup = {
if (stm.step()) if (stm.step())
daysOfHistory = stm.getInt32(0); daysOfHistory = stm.getInt32(0);
document.getElementById("historyCount").value = document.getElementById("historyCount").value =
this._stringBundle.formatStringFromName("historyCount.label", [daysOfHistory], 1); PluralForm.get(daysOfHistory,
this._stringBundle.GetStringFromName("historyDaysCount.label"))
.replace("#1", daysOfHistory);
// bookmarks // bookmarks
let bookmarks = 0; let bookmarks = 0;
@ -731,12 +734,16 @@ var gSyncSetup = {
if (stm.executeStep()) if (stm.executeStep())
bookmarks = stm.row.bookmarks; bookmarks = stm.row.bookmarks;
document.getElementById("bookmarkCount").value = document.getElementById("bookmarkCount").value =
this._stringBundle.formatStringFromName("bookmarkCount.label", [bookmarks], 1); PluralForm.get(bookmarks,
this._stringBundle.GetStringFromName("bookmarksCount.label"))
.replace("#1", bookmarks);
// passwords // passwords
let logins = Weave.Svc.Login.getAllLogins({}); let logins = Weave.Svc.Login.getAllLogins({});
document.getElementById("passwordCount").value = document.getElementById("passwordCount").value =
this._stringBundle.formatStringFromName("passwordCount.label", [logins.length], 1); PluralForm.get(logins.length,
this._stringBundle.GetStringFromName("passwordsCount.label"))
.replace("#1", logins.length);
this._case1Setup = true; this._case1Setup = true;
break; break;
case 2: case 2:
@ -762,7 +769,9 @@ var gSyncSetup = {
} }
if (count > 5) { if (count > 5) {
let label = let label =
this._stringBundle.formatStringFromName("additionalClients.label", [count - 5], 1); PluralForm.get(count - 5,
this._stringBundle.GetStringFromName("additionalClientCount.label"))
.replace("#1", count - 5);
appendNode(label); appendNode(label);
} }
this._case2Setup = true; this._case2Setup = true;

View File

@ -8,12 +8,22 @@ usernameNotAvailable.label = Already in use
verifying.label = Verifying… verifying.label = Verifying…
# LOCALIZATION NOTE (additionalClients.label, bookmarkCount.label, historyCount.label, passwordCount.label). # LOCALIZATION NOTE (additionalClientCount.label):
# We'll fix the lack of PluralForms in bug 583661. # Semi-colon list of plural forms. See:
additionalClients.label = and %S additional devices # http://developer.mozilla.org/en/docs/Localization_and_Plurals
bookmarkCount.label = %S bookmarks additionalClientCount.label = and %S additional device;and %S additional devices
historyCount.label = %S days of history # LOCALIZATION NOTE (bookmarksCount.label):
passwordCount.label = %S passwords # Semi-colon list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
bookmarksCount.label = %S bookmark;%S bookmarks
# LOCALIZATION NOTE (historyDaysCount.label):
# Semi-colon list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
historyDaysCount.label = %S day of history;%S days of history
# LOCALIZATION NOTE (passwordsCount.label):
# Semi-colon list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
passwordsCount.label = %S password;%S passwords
email.synckey.subject = Your Firefox Sync Key email.synckey.subject = Your Firefox Sync Key
email.synckey.body = Congratulations for signing up for Firefox Sync! Your secret Firefox Sync key is %S. Do not lose it or share with other people. email.synckey.body = Congratulations for signing up for Firefox Sync! Your secret Firefox Sync key is %S. Do not lose it or share with other people.
@ -27,4 +37,4 @@ wipeRemote.change.label = Firefox Sync will now replace all of the browser data
existingAccount.change.label = You can change this preference by selecting Sync Options below. existingAccount.change.label = You can change this preference by selecting Sync Options below.
# Several other strings are used (via Weave.Status.login), but they come from # Several other strings are used (via Weave.Status.login), but they come from
# /services/sync */ # /services/sync