On Oct 27, 10:40 am, Marnen Laibow-Koser <li...@ruby-forum.com> wrote: > Rob Biedenharn wrote in post #957481:> On Oct 27, 2010, at 8:35 AM, Vitaliy > Yanchuk wrote: > > >> How can I use proper word after number, depending on that number. > >> For example I have message that says: > > >> for 23 monthes, or it can be 21 month. > >> So I have to inflect depending on number > > >> -- > > > If you're in a Rails view, you can say: > > > pluralize(n, 'month') > > [...] > > ...but you probably shouldn't if you're going to internationalize the > application; different languages have different pluralization rules. > Any good I18N library should have a generalized pluralization function > (for example, there's n_ in fast_gettext).
I believe the proper Rails way to do it is the following: # view.html.erb t(:month_count, :count => month_number) # locale/en.yml en: month_count: one: '1 month' other: '%{count} months' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.