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 | |
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')
-rw-r--r-- | chrome/content/code/settings.xul.js | 20 | ||||
-rw-r--r-- | chrome/locale/en-US/redirector.properties | 9 |
2 files changed, 20 insertions, 9 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');
}
diff --git a/chrome/locale/en-US/redirector.properties b/chrome/locale/en-US/redirector.properties index 4395b5e..304f58f 100644 --- a/chrome/locale/en-US/redirector.properties +++ b/chrome/locale/en-US/redirector.properties @@ -17,8 +17,11 @@ exportCaption=Export redirects... importCaption=Import redirects... deleteConfirmationText=Are you sure you want to permanently delete this redirect? deleteConfirmationTitle=Delete redirect? -importedMessage=%S redirects were imported. -importedAndExistedMessage=%S redirects were imported, %S redirects were identical to existing redirects and were therefore not imported. -importedNoneAllExisted=All %S redirects in the file are identical to existing redirects, no redirects were imported. +importedMessage=%S redirects were imported +importedMessageSingular=%S redirect was imported +existedMessage=%S redirects were identical to existing redirects and were therefore not imported. +existedMessageSingular=%S redirect was identical to an existing redirect and was therefore not imported. +allExistedMessage=All %S redirects in the file were identical to existing redirects, no redirects were imported. +allExistedMessageSingular=The single redirect in the file was identical to an existing redirect and was therefore not imported. importedNone=There were no usable redirects in the given file, no redirects were imported. importResult=Import results
\ No newline at end of file |