Localized plural form support for Zotero.getString()
Zotero.getString() now takes a third parameter, `num` (which should also appear in `params`) to use when determining which plural form of the string to use. Localized strings should include all forms in the order specified in [1], separated by semicolons. [1] https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals
This commit is contained in:
parent
9836f33d41
commit
c61a9dc5f3
2 changed files with 45 additions and 3 deletions
19
test/tests/zoteroTest.js
Normal file
19
test/tests/zoteroTest.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
describe("Zotero", function() {
|
||||
describe("#getString()", function () {
|
||||
it("should return the right plural form", function* () {
|
||||
if (Zotero.locale != 'en-US') {
|
||||
this.skip();
|
||||
}
|
||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||
var str1 = Zotero.getString('fileInterface.importItemsWereImported')
|
||||
.split(/;/)[1]
|
||||
.replace('%1$S', 2);
|
||||
var str2 = Zotero.getString('fileInterface.importItemsWereImported', 2, 2);
|
||||
Zotero.debug(str1);
|
||||
Zotero.debug(str2);
|
||||
assert.equal(str1, str2);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue