There is a nicer way! Translating ActiveRecord validation messages is
built into Rails, so you don't have to make a I18n call at all.

Have a look at my post in how to do this: 
http://iain.nl/2008/09/translating-activerecord/
Chapter 5 and onwards are about validations.

Good luck,

Iain

On Sep 30, 11:21 am, fwalter <[EMAIL PROTECTED]> wrote:
> hi
>
> I am using custom error messages. but I only get the translation of
> the base_locale (en)
>
> validates_presence_of :email, :message =>
> I18n.t(:"validations.no_valid_email")
>
> The way to get other translations looks like bullshit:
> I tried to solve it that way:
>
> validates_presence_of :email, :message =>
> I18n.t(:"validations.no_valid_email", :locale => "en-US") , :if =>
> Proc.new { |c| I18n.locale.to_s == "en" }
> validates_presence_of :email, :message =>
> I18n.t(:"validations.no_valid_email", :locale => "de-DE") , :if =>
> Proc.new { |c| I18n.locale.to_s == "de" }
>
> is there a nicer way to get the translations in correct language?
>
> thanks for help
>
> florian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to