排除错误消息中的属性名称

我有一个简单的国际化:

attributes: user: login: Login errors: template: header: "Errors" body: "" models: user: attributes: login: taken: "The chosen {{attribute}} is already registered" 

生成的错误消息如下:

登录所选登录已经注册

看来,像Rails一样,会自动使用属性名称预先设置错误消息。 这迫使我只用一种方式安排消息 – 将属性名称作为第一个单词。

我需要以下错误消息:

所选的登录已经注册

如何配置Rails不添加属性名称的错误消息?

您需要指定错误消息格式才能删除模型名称。 我相信这只能在Rails 3.2.6及更高版本中使用。 有关Rails指南中I18n章节的更多详细信息 。

 en: errors: format: "%{message}" 

默认值为%{attribute} %{message}