Skip to content

Commit

Permalink
[Fix] French starts using plural at 2
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericEspiau authored and ljharb committed Dec 22, 2020
1 parent ce68bb0 commit 1cd6dbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var defaultPluralRules = {
bosnian_serbian: russianPluralGroups,
chinese: function () { return 0; },
croatian: russianPluralGroups,
french: function (n) { return n > 1 ? 1 : 0; },
french: function (n) { return n >= 2 ? 1 : 0; },
german: function (n) { return n !== 1 ? 1 : 0; },
russian: russianPluralGroups,
lithuanian: function (n) {
Expand Down
2 changes: 2 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@ describe('transformPhrase', function () {
// French rule: "0" is singular
expect(Polyglot.transformPhrase(english, { smart_count: 0 }, 'fr')).to.equal('0 Name');
expect(Polyglot.transformPhrase(english, { smart_count: 1 }, 'fr')).to.equal('1 Name');
expect(Polyglot.transformPhrase(english, { smart_count: 1.5 }, 'fr')).to.equal('1.5 Name');
// French rule: plural starts at 2 included
expect(Polyglot.transformPhrase(english, { smart_count: 2 }, 'fr')).to.equal('2 Names');
expect(Polyglot.transformPhrase(english, { smart_count: 3 }, 'fr')).to.equal('3 Names');

Expand Down

0 comments on commit 1cd6dbe

Please sign in to comment.