how to localize the active record error messages

给你一囗甜甜゛ 提交于 2020-01-24 12:56:04

问题


I try to figure out how I can localize the error item name in my rails application which appear when a user sign's up with uncorrect datas... I figured out how to override the messages but not the names of the messages like ("password", "login", "email", ...)

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: ""

Thanks Markus


回答1:


From the i18n guide this should work:

de:
  activerecord:
    attributes:
      user:
        login: Anmeldung


来源:https://stackoverflow.com/questions/3501019/how-to-localize-the-active-record-error-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!