无法在 vue-i18n 中使用复数
Can't get pluralization to work in vue-i18n
我的留言:
'time': '0 time | 1 time | {count} times'
我的模板:
{{ $t('time', repeat, { count: repeat }) }}
repeat
= 100 的输出:
0 time | 1 time | 100 times
而不是:
100 times
我做错了什么?
所以对于复数化你应该使用 $tc
而不是 $t
(http://kazupon.github.io/vue-i18n/api/#tc):
{{ $tc('time', repeat, { count: repeat }) }}
我的留言:
'time': '0 time | 1 time | {count} times'
我的模板:
{{ $t('time', repeat, { count: repeat }) }}
repeat
= 100 的输出:
0 time | 1 time | 100 times
而不是:
100 times
我做错了什么?
所以对于复数化你应该使用 $tc
而不是 $t
(http://kazupon.github.io/vue-i18n/api/#tc):
{{ $tc('time', repeat, { count: repeat }) }}