Answer the question
In order to leave comments, you need to log in
How to declare custom PluralizationRule vue-i18n Vue3?
Hello, I have a rule for pluralization from https://kazupon.github.io/vue-i18n/guide/pluraliza...
But declaring it as
setup() {
const { t, locale } = useI18n({
pluralizationRules: {
ru: function (choice, choicesLength) {
if (choice === 0) {
return 0;
}
const teen = choice > 10 && choice < 20;
const endsWithOne = choice % 10 === 1;
if (choicesLength < 4) {
return !teen && endsWithOne ? 1 : 2;
}
if (!teen && endsWithOne) {
return 1;
}
if (!teen && choice % 10 >= 2 && choice % 10 <= 4) {
return 2;
}
return choicesLength < 4 ? 2 : 3;
},
},
});
return { t, locale };
},
It doesn't change anything (that is, by 0 - seconds, 1 - second, and the rest seconds) - how can I fix this ? <i18n>
{
"en": {
"seconds":"{count} seconds | {count} second | {count} seconds"
},
"ru":{
"seconds":"{count} секунд | {count} секунда | {count} секунд"
}
}
</i18n>
Answer the question
In order to leave comments, you need to log in
"ru":{
"seconds":"{count} секунд | {count} секунда | {count} секунд"
}
"ru":{
"seconds":"ноль секунд | одна секунда | {n} секунды | {n} секунд"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question