如何本地化活动记录错误消息

Mar*_*kus 2 activerecord ruby-on-rails

我试图找出如何在我的rails应用程序中本地化错误项目名称,当用户使用不正确的数据签名时出现...我想出了如何覆盖消息而不是消息的名称("密码") ,"登录","电子邮件",......)

de:
  activerecord:
    errors:
      models:
        user:
          attributes:
            password_confirmation:
              blank: ""
            password:
              confirmation: ""
              blank:  ""
              too_short: ""
            login:
              taken: ""
              blank: ""
              too_short: ""
            email:
              taken: ""
              blank: ""
              too_short: ""
              invalid: ""
      template:
        header: ""
        body: ""
Run Code Online (Sandbox Code Playgroud)

谢谢马库斯

Sha*_*ell 5

i18n指南,这应该工作:

de:
  activerecord:
    attributes:
      user:
        login: Anmeldung
Run Code Online (Sandbox Code Playgroud)