如何本地化的活动记录错误信息 [英] how to localize the active record error messages

查看:100
本文介绍了如何本地化的活动记录错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何我可以在其中出现,当用户登录的与uncorrect DATAS我的Rails应用程序错误本地化项目名称......我想出如何重写信息,但如消息不是名字( 密码,登陆,电子邮件,...)

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

推荐答案

从的的国际化指南这应该工作:

de:
  activerecord:
    attributes:
      user:
        login: Anmeldung

这篇关于如何本地化的活动记录错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆