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 9e70606cf3
commit fa33da614a
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://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;