diff options
author | Einar Egilsson | 2009-10-14 11:26:26 +0000 |
---|---|---|
committer | Einar Egilsson | 2009-10-14 11:26:26 +0000 |
commit | fe10350d0c16eb700e22960c34c25c4d8b50d94f (patch) | |
tree | af89d937af250679caa03a1d0b11a278d11e51dd /chrome/content/code/settings.xul.js | |
parent | cfc2965fb35256a3493485f32ff9bd605bf158b7 (diff) |
Pluralization correct, off by one error in import
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@267 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/code/settings.xul.js')
-rw-r--r-- | chrome/content/code/settings.xul.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/chrome/content/code/settings.xul.js b/chrome/content/code/settings.xul.js index 3efe061..c7b375c 100644 --- a/chrome/content/code/settings.xul.js +++ b/chrome/content/code/settings.xul.js @@ -41,6 +41,10 @@ var Settings = { this.addItemsToListBox(Redirector.list);
this.strings = document.getElementById('redirector-strings');
+ this.strings.getPluralized = function(id, number) {
+ id += number == 1 ? 'Singular' : '';
+ return this.getFormattedString(id, [number]);
+ };
} catch(e) {
alert(e);
}
@@ -230,13 +234,17 @@ var Settings = { return Redirector.importRedirects(file);
});
- var msg;
- if (result.imported > 0 && result.existed == 0) {
- msg = this.strings.getFormattedString('importedMessage', [result.imported]);
- } else if (result.imported > 0 && result.existed > 0) {
- msg = this.strings.getFormattedString('importedAndExistedMessage', [result.imported, result.existed]);
+ var msg
+
+ if (result.imported > 0) {
+ msg = this.strings.getPluralized('importedMessage', result.imported);
+ if (result.existed > 0) {
+ msg += ', ' + this.strings.getPluralized('existedMessage',result.existed);
+ } else {
+ msg += '.';
+ }
} else if (result.imported == 0 && result.existed > 0) {
- msg = this.strings.getFormattedString('importedNoneAllExisted', [result.existed]);
+ msg = this.strings.getPluralized('allExistedMessage', result.existed);
} else { //Both 0
msg = this.strings.getString('importedNone');
}
|