You just need to use rails' built-in i18n feature.
Drop a en.yml in config/locales with content like this:
en:
activerecord:
models:
user: "User"
attributes:
user:
login: "user name"
errors:
messages:
blank: 'should not be blank'
---
in model:
validates_presence_of :login
---
in environment.rb:
config.i18n.default_locale = :en
Then if the user doesn't enter a user name for the login field, the
error message will be like this:
user name should not be blank
--
James
http://ashchan.com
On Sep 14, 10:11 pm, Aldo Italo <[email protected]>
wrote:
> a question about error_messages_for:
>
> when i retrieve the error messages the error_messages_for display a list
> errors with the name of input followed the customizable string error.
>
> But if i want to change the name of input on the error message how can i
> do?
> imagine for example i need to translate the errors messages in various
> languages....
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---