Reputation: 357
Now I want to use error.full_messages
to display the error messages. But it's default language is English. I want to show other language's error message. How can I do that? Or I have to self define something?
Thank you!
Upvotes: 1
Views: 2557
Reputation: 16793
Assuming you're referring to error messages for your models, you can internationalize your error messages in your locale yaml files using the activerecord.errors
key. For example:
en:
activerecord:
errors:
models:
user:
attributes:
name:
blank: can't be blank
email:
blank: can't be blank
invalid: is invalid
password:
too_short: is too short (minimum is 6 characters)
See section 5.1.1 of the Rails i18n guide for more details on i18n-izing error messages.
Upvotes: 1