Skip to content

Commit

Permalink
🐛 bug(pluralization): fix default choice
Browse files Browse the repository at this point in the history
Closes #164
  • Loading branch information
kazupon committed May 23, 2017
1 parent 3ef58fc commit 240cfed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default class VueI18n {
if (choice !== undefined) {
return fetchChoice(this._t(key, _locale, messages, host, ...values), choice)
} else {
return this._t(key, _locale, messages, host, ...values)
return fetchChoice(this._t(key, _locale, messages, host, ...values), 1)
}
}

Expand Down
6 changes: 6 additions & 0 deletions test/unit/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ describe('basic', () => {
})

describe('i18n#tc', () => {
describe('default choice', () => {
it('should be choice singluar', () => {
assert.equal(i18n.tc('plurals.apple'), 'one apple')
})
})

describe('split plural with zero choice', () => {
it('should allow a zero choice, a one choice and a plural choice', () => {
const count = 10
Expand Down

0 comments on commit 240cfed

Please sign in to comment.