Skip to content

Commit 70bd435

Browse files
committed
Merge branch 'nterray-infinity-as-plural'
2 parents 20a1802 + 70699ea commit 70bd435

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/plurals.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default {
1111

1212
getTranslationIndex: function (languageCode, n) {
1313

14-
n = parseInt(n)
14+
n = Number(n)
1515
n = typeof n === 'number' && isNaN(n) ? 1 : n // Fallback to singular.
1616

1717
// Extract the ISO 639 language code. The ISO 639 standard defines

test/specs/plurals.spec.js

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ describe('Translate plurals tests', () => {
1111
expect(plurals.getTranslationIndex('en', 2)).to.equal(1)
1212
})
1313

14+
it('plural form of Infinity in english is 1', function () {
15+
expect(plurals.getTranslationIndex('en', Infinity)).to.equal(1)
16+
})
17+
1418
it('plural form of zero in english is 1', function () {
1519
expect(plurals.getTranslationIndex('en', 0)).to.equal(1)
1620
})

0 commit comments

Comments
 (0)