2

工作: [在区域设置为 时有效en] 当我单击“发送”按钮时,它会显示错误消息name is blankemail is blank如 、 等(当字段为空时),这很好。输出如下所示:

3 errors prohibited this message from being sent:

Email can't be blank
Email is invalid
Subject can't be blank

不工作:但是 [当区域设置为时不工作es] 当我单击“发送”按钮时,它会显示下面列出的错误消息:

3 errors prohibited this message from being sent:

Email translation missing: es.activemodel.errors.models.message.attributes.email.blank
Email translation missing: es.activemodel.errors.models.message.attributes.email.invalid
Subject translation missing: es.activemodel.errors.models.message.attributes.subject.blank

问题所以我如何使这个翻译工作需要帮助,时间不多了。

谢谢。

4

1 回答 1

2

您的 es 语言环境文件中是否设置了值 es.activemodel.errors.models.message.attributes.email.blank?

像这样在es.yml

es:
  activemodel:
    errors:
      models:
        message:
          attributes:
            email:
              blank: "I don't speak spanish I can't give an example ... Shame on me!"
于 2012-11-20T16:25:10.120 回答