Out-of-the-box CLDR pluralization rules
I started from an InvalidPluralizationData error in my rails app, and realized that it isn't using the CLDR plural rules like I thought it was.
Then I came across https://github.com/svenfuchs/i18n/wiki/Pluralizations:
We still have to figure out how to actually ship a bunch of default pluralizers best...
I'm willing to work on this, as I'd much rather have the standard CLDR rules live upstream instead of copying them into the translation data and maintaining them as the CLDR releases get updated.
My first thought would be to just ship a simple CLDR backend as an alternative to the Pluralization one, like this: https://github.com/ragesoss/i18n/commit/6838e4ba7f240762e178ef46b1dfbc54d7469a21
Is that a viable direction to go?
@ragesoss have you checked: https://github.com/svenfuchs/rails-i18n ?
@dmitry I had not, thanks! So it looks like although this gem is part of rails by default, the way to get automatic per-language pluralization rules is to explicitly add the rails-i18n gem. (Maybe I will try to do a PR for the Rails guides, because this is something that I did not pick up from http://guides.rubyonrails.org/i18n.html#pluralization)
The unicode pluralization rules aren't a rails-specific thing, though. Should they live here rather than in rails-i18n?
Probably it's a good idea to add/move them to i18n gem, but in that case all those features should be lazy loaded.
For the feature-wide support of CLDR formatting and localization check out also a twitter gem: https://github.com/twitter/twitter-cldr-rb
n.b.: rails-i18n doesn't match CLDR's pluralization rules in all cases.
For example, rails-i18n uses its east_slavic rules for bs, which means that it tries to use the many key for 0.
However, CLDR doesn't think that many is a valid key for bs at all (source).
Update: This is a bug and will be fixed in https://github.com/svenfuchs/rails-i18n/pull/987