BTW, there's an amazingly detailed doc on plural forms here: http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
(grabbed from the Rails i18n guide: http://guides.rubyonrails.org/i18n.html ) Not sure exactly who defines the split between 'few' and 'many', but the system can apparently handle breaking out pluralization to: zero one two few many other The above guide will provide some details on using I18n.t; here's the link to the Hobo-specific info for things like <ht>: http://cookbook.hobocentral.net/manual/i18n Hope this helps! --Matt Jones On Oct 1, 2010, at 5:11 PM, Scorpio wrote: > i'm not quite sure i get the order of things. i translated the whole > yml file to the best of my ability and now do i need to put > > your_key: > one: singular_word > many: paucal_word > other: plural_word > > for every model at the top of the file or the version below? Because > unless I'm reading this wrong they should do the same thing > > pl: > activerecord: > models: > your_model: > > Once thats done what do i do with statements like edit_link: > "Edytuj {{model}}" where i need a 4th form not the base one ? > > > > Also.. where do i put the I18n.t('your_key', :count => n) selecting > the singular,paucal, plural forms? Sorry its my first try at > internationalization and i'm green as grass > > I'm gonna give an example so that I can be clear > 1 Kategoria > 2 Kategorie > 5 Kategorii > Edit/Update KategoriÄ™ > > Sorry to ask for a step by step guide but I have no idea how to call > those forms later in code (how do i tell i18n when to use what?). > Secondly how do i tell the app to use pl.dryml for rails messages > hobo.pl.dryml for hobo parts and app.pl for the grammar forms for my > app and all? > > On Oct 1, 10:11 pm, Domizio Demichelis <[email protected]> wrote: >> 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. > -- 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.
