From 51331905b7e8e6084b31fce734cb9910bebde198 Mon Sep 17 00:00:00 2001 From: Vlado Valastiak Date: Fri, 10 Sep 2010 22:02:57 +0200 Subject: [PATCH] Bug 570957 - Use PluralForm for Sync Strings (additionalClients.label and friends), r=mconnor, a=blocking2.0 beta6+ --- browser/base/content/syncSetup.js | 17 +++++++++---- .../en-US/chrome/browser/syncSetup.properties | 24 +++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/browser/base/content/syncSetup.js b/browser/base/content/syncSetup.js index 4ce05d63be6..6ec347cfd2b 100644 --- a/browser/base/content/syncSetup.js +++ b/browser/base/content/syncSetup.js @@ -58,6 +58,7 @@ const SETUP_SUCCESS_PAGE = 8; Cu.import("resource://services-sync/main.js"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/PluralForm.jsm"); var gSyncSetup = { QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, @@ -718,7 +719,9 @@ var gSyncSetup = { if (stm.step()) daysOfHistory = stm.getInt32(0); document.getElementById("historyCount").value = - this._stringBundle.formatStringFromName("historyCount.label", [daysOfHistory], 1); + PluralForm.get(daysOfHistory, + this._stringBundle.GetStringFromName("historyDaysCount.label")) + .replace("#1", daysOfHistory); // bookmarks let bookmarks = 0; @@ -731,12 +734,16 @@ var gSyncSetup = { if (stm.executeStep()) bookmarks = stm.row.bookmarks; document.getElementById("bookmarkCount").value = - this._stringBundle.formatStringFromName("bookmarkCount.label", [bookmarks], 1); + PluralForm.get(bookmarks, + this._stringBundle.GetStringFromName("bookmarksCount.label")) + .replace("#1", bookmarks); // passwords let logins = Weave.Svc.Login.getAllLogins({}); 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; break; case 2: @@ -762,7 +769,9 @@ var gSyncSetup = { } if (count > 5) { 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); } this._case2Setup = true; diff --git a/browser/locales/en-US/chrome/browser/syncSetup.properties b/browser/locales/en-US/chrome/browser/syncSetup.properties index 5bf9f9ea0f4..670506f3f21 100644 --- a/browser/locales/en-US/chrome/browser/syncSetup.properties +++ b/browser/locales/en-US/chrome/browser/syncSetup.properties @@ -8,12 +8,22 @@ usernameNotAvailable.label = Already in use verifying.label = Verifying… -# LOCALIZATION NOTE (additionalClients.label, bookmarkCount.label, historyCount.label, passwordCount.label). -# We'll fix the lack of PluralForms in bug 583661. -additionalClients.label = and %S additional devices -bookmarkCount.label = %S bookmarks -historyCount.label = %S days of history -passwordCount.label = %S passwords +# LOCALIZATION NOTE (additionalClientCount.label): +# Semi-colon list of plural forms. See: +# http://developer.mozilla.org/en/docs/Localization_and_Plurals +additionalClientCount.label = and %S additional device;and %S additional devices +# LOCALIZATION NOTE (bookmarksCount.label): +# 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.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. # Several other strings are used (via Weave.Status.login), but they come from -# /services/sync */ +# /services/sync