-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Plural ranges #529
Comments
Thanks for great question! We use the ICU parser from Format.JS currently, so we support all of these: https://formatjs.io/docs/core-concepts/icu-syntax#plural-format This is obviously missing in the docs though (same for |
@amannn Oh, Thanks for the prompt reply. I think it might be worth adding that link to the docs as quick solution, until further enhancements down the road.. |
Yep, we should absolutely include that list of possible options both for |
After my working day today, I'll make the time to open a PR with the documentation. |
That's very kind, thanks! We tend to avoid external links by now when the content is important and not supplemental. E.g. for the date formats we have a table that contains all valid symbols: https://next-intl-docs.vercel.app/docs/usage/dates-times#dates-and-times-within-messages I think similarly to this, we could include the list of supported pluralization forms. Maybe we'll switch the parser at some point, I think this documentation could also be helpful to ensure we continue to support the same use cases. |
Is your feature request related to a problem? Please describe.
In Arabic we have different forms of the plural word for different ranges of the number (for more information check here).
Usually the ranges are:
Example using the word Book in Arabic:
I tried to dig in the code and found nothing, and it wasn't mentioned in the docs, so I don't know if this feature exists, that's why I opened this ticket.
Describe the solution you'd like
So to decrease repetition, can we add a feature where we can define ranges of numbers not only single number while defining the different plural translations.
Proposed solutions:
"{variable, plural, =1 {One Plural} =3:10 {# Plurals} other {# Other Plural Form}}"
(best DX)"{variable, plural, =1 {One Plural} =3-10 {# Plurals} other {# Other Plural Form}}"
(decent DX)"{variable, plural, =1 {One Plural} =3 =4 =5 =6 =7 =8 =9 =10 {# Plurals} other {# Other Plural Form}}"
(not so good DX, but definitely better than nothing)Describe alternatives you've considered
To be able to do this now it will require a ton of repetition:
The text was updated successfully, but these errors were encountered: