Inside a model is used like this:
I18n.t(:username_in_use)
You can also put it in the translation yml like this:
es:
activerecord:
errors:
messages:
taken: "ya está en uso"
There are more examples in:
http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale
Regards.
Franco Catena.
On Apr 23, 8:43 am, Heinz Strunk
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hey people,
>
> I''m having a problem translating messages inside a model, e.g. I
used to
> have it like this:
>
> validates_uniqueness_of :username, :message => "Username in use
already"
>
> which worked fine but now I wanna internationalize my application and
> thought it''d work like everywhere else in my application and I did
> following:
>
> validates_uniqueness_of :username, :message => (t :username_in_use)
>
> and I get: `method_missing'': undefined method `t''
>
> Is it not possible to translate text inside a model? If it is... how do
> I do it the right way?
> --
> Posted viahttp://www.ruby-forum.com/.