Bug 1172768 - Loop's desktop plural form handling doesn't handle zeros very well. r=mikedeboer

This commit is contained in:
Mark Banner 2015-06-10 14:12:42 +01:00
parent 73392f2f41
commit 40995be175
2 changed files with 7 additions and 2 deletions

View File

@ -38,8 +38,9 @@
// translate a string
function translateString(key, args, fallback) {
if (args && args.num) {
var num = args && args.num;
var num;
if (args && ("num" in args)) {
num = args.num;
}
var data = getL10nData(key, num);
if (!data && fallback)

View File

@ -34,4 +34,8 @@ describe("document.mozL10n", function() {
it("should get a plural form", function() {
expect(document.mozL10n.get("plural", {num: 10})).eql("10 plural forms");
});
it("should correctly get a plural form for num = 0", function() {
expect(document.mozL10n.get("plural", {num: 0})).eql("0 plural form");
});
});