Search code examples
vue-i18n

Can't get pluralization to work in vue-i18n


my message:

'time': '0 time | 1 time | {count} times'

my template:

{{ $t('time', repeat, { count: repeat }) }}

the ouput for repeat = 100:

0 time | 1 time | 100 times

instead of:

100 times

What did I do wrong?


Solution

  • so for pluralization you are supposed to used $tc instead of $t (http://kazupon.github.io/vue-i18n/api/#tc):

    {{ $tc('time', repeat, { count: repeat }) }}