I am trying to translate some counter of items according to the grammar of the language. I faced with an issue that doc says about plural forms and they are different for each language. I expected that rules are already inside I18n
and what I need to do is just fill translations. But when I read the code of pluralize
method at i18n/backend/base.rb
def pluralize(locale, entry, count)
return entry unless entry.is_a?(Hash) && count
key = :zero if count == 0 && entry.has_key?(:zero)
key ||= count == 1 ? :one : :other
raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
entry[key]
end
I found that it supports only en
. For example I am working now on arabic translation.
I18n.backend.store_translations :ar, path: { one: 'one', two: 'two', other: 'other', many: 'many', few: 'few'}
Here I filled translation backend and I expect that if I pass count
option 11 then I receive :many
translation as specified by the language plural rules.
I18n.t :path, count: 11, locale: :ar #should return 'many'
Do I need to specify those rules myself? Then where? Or do I need swizzle something?