How to translate default error messages in rails?

This not worked for me when i tried to change error_messages_for messages in translation.yml file:

activerecord:
 errors:
  template:
    header:
      one:   "Oops error"
      other: "Many errors"
    body:    "There were problems:"

What can i do to translate "1 error prohibited this product from being saved:"? What file contain their text?

Upvotes: 0

Views: 524

Answers (1)

Dylan Markow
Dylan Markow

Reputation: 124469

I believe you only need the activerecord: part if you're on Rails 2.x. The problem may be that your top level wasn't a language. As of Rails 3.x (which uses the separate dynamic_form plugin now to handle this), the defaults are:

en:
  errors:
    template:
      header:
        one:    "1 error prohibited this %{model} from being saved"
        other:  "%{count} errors prohibited this %{model} from being saved"
      # The variable :count is also available
      body: "There were problems with the following fields:"

Upvotes: 1

Related Questions