Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2049 closed defect (fixed)

support proper pluralization for other languages

Reported by: StefanB Owned by: Tom Hughes
Priority: major Milestone:
Component: website Version:
Keywords: i18n Cc:


Currently ruby backend (with globalize2 and rails-i18n plugins) supports pluralization into only 3 forms, namely ":zero" ":one" and ":other", which is ok for English and perhaps some other languages.

It is not suitable for dynamically switching languages, serving several languages with different pluralizaton formula at the same time.

Specifically, pluralization formula for Slovenian should be something like:

@backend.add_pluralizer :sl, lambda{|c|

c == 0 ? :zero : c%100 == 1 ? :one : c%100 == 2 ? :two : (3..4).include?(c%100) ? :few : :other


but there is no place to put it to have an effect, and not break current English website at the same time.

Change History (3)

comment:1 Changed 11 years ago by tomhughes

Resolution: fixed
Status: newclosed

(In [16473]) Add custom pluralizer for Slovenian. Fixes #2049.

comment:2 Changed 11 years ago by Tom Hughes

The activerecord.errors.template.header resource in vendor/plugins/rails-i18n/locale/sl.rb needs fixing to have the extra keys. I've hacked it for now by copying the :other key but you'll need to fix it properly.

Also I don't know if the globalize2 people would be interested in having the custom pluralizer upstream?

comment:3 Changed 11 years ago by StefanB

Tnx for putting it in, seems to wokr fine, but some additional translations are needed if i understand the error message "Error contacting uninitialized constant Globalize::Backend::Pluralizing::InvalidPluralizationData?" correctly.

Will check and add the missing ones later today.

Note: See TracTickets for help on using tickets.