Skip to content
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

Wrong pluralization rules. #461

Open
Exoth opened this issue Jun 26, 2014 · 2 comments
Open

Wrong pluralization rules. #461

Exoth opened this issue Jun 26, 2014 · 2 comments

Comments

@Exoth
Copy link

Exoth commented Jun 26, 2014

Pluralization rules for the Engilsh and many other languages are wrong. CLDR contains the right pluralization rules, and ruby-cldr gem gives them as ruby code. For example, for :en locales it is like this:

lambda { |n| n = n.respond_to?(:abs) ? n.abs : ((m = n.to_s)[0] == "-" ? m[1,m.length] : m); (n.to_i == 1 && ((v = n.to_s.split(".")[1]) ? v.length : 0) == 0) ? :one : :other }

Here's a CLDR defined difference:

1.0 - CLDR: other, rails-i18n: one

This difference comes from ruby-cldr as CLDR doesn't seem to define rules for negative numbers (also coverd by #270):
-1 - ruby-cldr: one, rails-i18n: other

Explanations of why rails-i18n is wrong in these two cases is in the answer here: http://english.stackexchange.com/questions/69162/are-these-plural-or-singular

I propose not to change globally OneOther pluralization for all the locales, but to fix languages one by one whenever we are sure that it works some way. So this issue is about fixing :en and :en-xx pluralizations.

Also one more general ruby-cldr difference:

'1' - ruby-cldr: one, rails-i18n: other

I think, that converting strings to numbers for the check is nice.

@Exoth
Copy link
Author

Exoth commented Jun 26, 2014

Though now I think that abs() could be used globally until we get some evidence, that it doesn't work this way in some language. At least this way we'll fix more locales than we'll break.

@gorn
Copy link
Contributor

gorn commented Sep 30, 2018

abs works well for cs locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants