-
-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add 0 plural option for English #1220
Comments
Yes. English has no extra form for zero - that's why you can't define photos_0 for english. But there is a plugin to help with this: https://github.com/i18next/i18next-intervalPlural-postProcessor Just define in the interval the extra form for zero - all others not getting handled by an interval will automatically fallback to regular plural forms. |
Thank you |
If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project -> there are many ways to help this project 🙏 |
We can use Context for this purpose. Example: {
"photos_0": "no photo",
"photos": "one photo",
"photos_plural": "{{count}} photos"
} const count = 0;
i18next.t('photos', {count: count, context: `${count}`}) |
We can't we add
Straight from RubyOnRails ;) https://guides.rubyonrails.org/i18n.html#pluralization |
@kg-currenxie so there is the |
yes, i didn't say its a plural form the other plural forms, like arabic can still use the |
@kg-currenxie other languages like arabic have an extra form for zero https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_plural_rules.html#ar |
Hello,
This works as expected for the English language:
But I would like to also add a phrase when count is 0 like this
Above doesn't work because I read somewhere else you said it depends on the language rules. So for Russian above will work but this isn't possible for English. Is there a way to over ride this with something custom? At the moment to deal with this I am using if-else block to check if count is 0 so I can use the translation when count is 0.
The text was updated successfully, but these errors were encountered: