Skip to content

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

@neildaniels

Description

@neildaniels

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions