Skip to content
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

I18n::translateCount() does not work with languages with more than 3 cardinal forms #2430

Closed
neildaniels opened this issue Feb 6, 2020 · 1 comment · Fixed by #2432
Closed
Assignees
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Milestone

Comments

@neildaniels
Copy link
Contributor

Describe the bug
For languages such as Czech, Irish, Russian, or Welsh, the current I18n::translateCount() and tt() functions are not helpful. The current functions assume there can be only 3 forms of numbers (for 0, 1, and everything else).

For a language like Irish, there can be 5 distinct forms:

  • when the value is 1
  • when the value is 2
  • when the value is 3, 4, 5, or 6
  • when the value is 7, 8, 9, or 10
  • when the value is anything else, such as 0, 11, 24

Unicode has a published table documenting nearly every language's rules: https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

Mozilla has a more approachable document for this: https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals

I suspect ngettext would be helpful to use in this scenario.

Kirby Version
3.3.3

@afbora afbora added the type: enhancement ✨ Suggests an enhancement; improves Kirby label Feb 8, 2020
afbora added a commit that referenced this issue Feb 8, 2020
lukasbestle added a commit that referenced this issue Feb 23, 2020
@lukasbestle lukasbestle added this to the 3.3.5 milestone Feb 23, 2020
@afbora afbora linked a pull request Feb 23, 2020 that will close this issue
4 tasks
@distantnative distantnative removed this from the 3.3.5 milestone Mar 5, 2020
@lukasbestle lukasbestle added this to the 3.4.0 milestone Apr 5, 2020
@bastianallgeier
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants