ruby-i18n / i18n

Internationalization (i18n) library for Ruby
MIT License
977 stars 408 forks source link

Get closer to full CLDR pluralization support #634

Closed movermeyer closed 1 year ago

movermeyer commented 2 years ago

What are you trying to accomplish?

A step towards CLDR pluralization. Ref: https://github.com/ruby-i18n/i18n/issues/629

Previously, I put forth a PR, that was reverted in #633 since dropping [incorrect] support for zero key is a breaking change.

This PR is the same as #630 (adding support for explicit 0/1 keys and basic lateral inheritance), but maintains the existing [incorrect] zero key behaviour.

What approach did you choose and why?

I brought back the changes from my first attempt, but also brought back the [incorrect] zero key behaviour:

Some progress towards CLDR compatibility is better than none. Removal of the zero key behaviour will be done in a separate PR.

Q&A

Q: Are 0 & 1 the only special cases, or can one introduce others? Perhaps 2: I have a pair of cars A: It might be allowed, depending on how you read the spec... but the spec only mentions 0 and 1, the LDML DTD only considers 0 and 1 to be valid, and CLDR has only ever used 0 and 1. I left support for arbitrary numbers out of this PR, as I figure that it would be better to be restrictive with what we accept right now. It's an easy change to accept other values if it turns out to be desirable.

The impact of these changes

Pluralization lookups will will support CLDR's data. Ref: #629 for details of why these changes are important.

movermeyer commented 1 year ago

cc @radar this is ready for review

radar commented 1 year ago

This looks good to me. Thanks @movermeyer!

movermeyer commented 1 year ago

Hey @radar, whenever you get some time, could we get a new release of ruby-i18n/i18n? 🙏

I'm eagerly awaiting the time when I can start using these features.