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
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
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/.