A little clarification:
1. Hobo i18n is simply Rails I18n applied to the hobo internals, i.e. you
can change/translate the strings that hobo produce as its output, but the
mechanism that do so is Rails I18n, not Hobo.
2. Rails I18n uses the I18n gem to do its job, so the real engine is the
gem. If you are interested, you might google for it and read a little bit
about its possibilities
3. AFAIK, the I18n gem has been designed to allows multi-pluralization
languages such as Polish, with a real simple but powerful way to do so: it
looks up strings from a yml structure, and do its pluralization based on the
:count option. Set the right keys in the yml and pass the right :count and
you will pick the right pluralization for any word in any language.
4. The pluralization of different genders is achieved by simply add a key
for each word or sentence you have to pluralize. I don't speak Polish, but I
speak Italian, Spanish and French that do have genders, and all those
languages have not only different genders, but also a lot of exceptions.
It's not a matter of a single "algorithm" to try to pluralize different
genders... it's just a matter of writing 2 or 3 or 4 translated string for
each word or sentence you have to translate, depending of how many plural
has your language, and even exceptions will be correctly translated if you
pass the right :count.
your_key:
one: singular_word
many: paucal_word
other: plural_word
I didn't try with polish, but from what you said about pluralization I guess
that if your locale is :pl and you do something like
n = 1
I18n.t('your_key', :count => n)
#=> "singular_word"
n = 3
I18n.t('your_key', :count => n)
#=> "paucal_word"
n = 100
I18n.t('your_key', :count => n)
#=> "plural_word"
So no algorithm, just plain key/value pairs.
Now, to answer to your question:
Is there a way to hard-code the plural and singular form of each model
> for say 1,<2,4>, <5, infinity) items in a collection and then make the
> i18n display that hard-coded grammar form depending on the number of
> items in a collection ?
>
Yes: just add the name of each of your models under:
activerecord.models.<model_name>
and add as many pluralization your language needs, like:
pl:
activerecord:
models:
your_model:
one: singular_model_translation
many: paucal_model_translation
other: plural_model_translation
your_other_model:
one: ...
many: ...
other: ...
Then you have to set the :pl as the locale and hobo will display the correct
translations.
Hoping that helps.
ciao
dd
>
>
>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.