i18n
https://github.com/svenfuchs/i18n
Ruby
Internationalization (i18n) library for Ruby
I18n::Backend::Pluralization#pluralize
Overwrites the Base backend translate method so that it will check the translation meta data space (:i18n) for a locale specific pluralization rule and use it to pluralize the given entry. I.e. the library expects pluralization rules to be stored at I18n.t(:'i18n.plural.rule') Pluralization rules are expected to respond to #call(count) and return a pluralization key. Valid keys depend on the translation data hash (entry) but it is generally recommended to follow CLDR's style, i.e., return one of the keys :zero, :one, :few, :many, :other. The :zero key is always picked directly when count equals 0 AND the translation data has the key :zero. This way translators are free to either pick a special :zero translation even for languages where the pluralizer does not return a :zero key.
Edit
git clone [email protected]:svenfuchs/i18n.git
cd i18n
open lib/i18n/backend/pluralization.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-I18n--Backend--Pluralization-pluralize-for-pr
# Commit to gitgit add lib/i18n/backend/pluralization.rbgit commit -m "better docs for I18n::Backend::Pluralization#pluralize"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-I18n--Backend--Pluralization-pluralize-for-pr
hub pull-request
# Celebrate!