aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chrome/content/code/settings.xul.js20
-rw-r--r--chrome/locale/en-US/redirector.properties9
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