ruby-gettext / gettext

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.
https://ruby-gettext.github.io/
69 stars 28 forks source link

Plurals don't work without `red-datasets` gem #93

Open MichaelHoste opened 2 years ago

MichaelHoste commented 2 years ago

It's a bit like #87 but in production too.

Since red-datasets is not included as runtime dependency, plural forms of languages are now always ignored by default: https://github.com/ruby-gettext/gettext/blob/master/lib/gettext/tools/msginit.rb#L382

I'm not sure it was voluntary because that's a big change for a minor version.

Shouldn't we explicitly tell that red-datasets is mandatory for plural management in the "installation" part of the README?

Or maybe find a better way to manage plurals? I don't really like the fact that plural rules could change without any manual update of this gem (plural rules are now parsed live).

Also, there are some parsing issue with specific languages that I'm not sure have been fixed:

A hash containing all plurals, bundled with this gem, would certainly be a better solution.

This hash could be manually updated using red-datasets if the problematic plural forms have been fixed.

kou commented 2 years ago

How about making plurals detection logic in MsgInit pluggable and using red-datasets based plurals detector by default? If red-datasets gem isn't available, "please install red-datasets gem" error message is raised.

We also bundle do-nothing plurals detector. Fedora package users can use it by specifying an option explicitly such as --plurals-detector=null.

You can implement custom plurals detector based on fixed data. (I don't want to release a new version for each new CLDR release...)

Also, there are some parsing issue with specific languages that I'm not sure have been fixed:

Could you create 2 new issues for them?