zotero/test/tests/zoteroTest.js
Dan Stillman c61a9dc5f3 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
2016-12-11 02:30:34 -05:00

20 lines
557 B
JavaScript

"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);
});
});
});