Actually, no it doesn't. I still have to do I18n.t instead of t in person.rb, despite TranslateForModels in lib/i18n.rb.
On Fri, Jan 2, 2009 at 10:37 AM, Redd Vinylene <[email protected]> wrote: > Once again, thank you so much! > > Works perfectly! > > On Thu, Jan 1, 2009 at 6:44 PM, Iain Hecker <[email protected]> wrote: >> >> Maybe using the application helper is not a good idea, because it has >> methods specific to views, but you can make your own module and mix it >> in. >> >> module TranslateForModels >> def t(*args); I18n.t(*args); end >> end >> ActiveRecord::Base.send :include, TranslateForModels >> >> The proper place would be in the lib directory. >> >> Iain >> >> On Thu, Jan 1, 2009 at 15:56, Redd Vinylene <[email protected]> wrote: >>> >>> Thank y'all so much! >>> >>> I got the following in applications_helper.rb so I can say t instead of >>> I18n.t: >>> >>> def t(*args) >>> translate(*args) >>> end >>> >>> How do I make this work for my models as well? Would an "extend >>> ApplicationsHelper" to person.rb be a wise choice? I've heard some >>> people don't really like that. >>> >>> Cheers! >>> >>> On Thu, Jan 1, 2009 at 2:44 PM, Iain Hecker <[email protected]> wrote: >>>> >>>> Hi Redd, >>>> >>>> yes >>>> >>>> Iain >>>> >>>> PS: Just add I18n.t(h) at the last line >>>> >>>> On Thu, Jan 1, 2009 at 13:38, Redd Vinylene <[email protected]> wrote: >>>>> >>>>> I got this in my person.rb: >>>>> >>>>> def him_or_her >>>>> h = "him" if gender == "male" >>>>> h = "her" if gender == "female" >>>>> h >>>>> end >>>>> >>>>> Is it possible to translate "him" and "her"? >>>>> >>>>> -- >>>>> http://www.home.no/reddvinylene >>>>> >>>>> > >>>>> >>>> >>>> > >>>> >>> >>> >>> >>> -- >>> http://www.home.no/reddvinylene >>> >>> > >>> >> >> >> >> > > > > -- > http://www.home.no/reddvinylene > -- http://www.home.no/reddvinylene --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rails-i18n" 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/rails-i18n?hl=en -~----------~----~----~----~------~----~------~--~---
