-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Why there's "#include?" and no "#between?" methods? #744
Comments
I suspect include, in combination with to_a, is to prevent fractional numbers from being regarded as :few or :many. CLDR states fractional in Russian are :other. Your code returns :other directly for Floats (same as I am doing myself in another project) but the current rails-i18n code doesn't, and have to take these into account for all clauses. Btw, I think this:
reads slightly better than this:
I don't speak Russian so I don't really know but I get an impression it is the values ending with 1-4 (exuding those ending with 11-14) that sticks out, and those ending with 0, 5-9 and 11-20 being some sort of default. |
I'm sorry, could you just give an example of different results? |
This is in the current implementation, with only round numbers being treated as > RailsI18n::Pluralization::EastSlavic.rule.call(2.0)
# => :few
> RailsI18n::Pluralization::EastSlavic.rule.call(2.5)
# => :other |
I got it but, as I suggested, all this can be skipped with
|
I think we would like to keep the current behavior of having |
All right, fair enough |
I don't understand why is used #include? instead of #between? method in conditions for pluralizations, like here /lib/rails_i18n/common_pluralizations/east_slavic.rb
In that example, when count
is_a? String
there's no errors raised and result is:other
.It happens because of String#% method.
Well,
count
is supposed to be kind ofNumeric
right? (if not, you may stop reading here)So, I really like this gem and, wanting to improve it, I simply offer you this solution:
It's the most relevant for those locales that has long irregular ranges like /rails/pluralization/ar.rb
where methods
to_a
andinclude?
are called for each time.I can make all this job and pull request if you give green light.
The text was updated successfully, but these errors were encountered: