[英]How to translate default error messages in rails?
当我尝试更改translation.yml文件中的error_messages_for消息时,这对我不起作用:
activerecord:
errors:
template:
header:
one: "Oops error"
other: "Many errors"
body: "There were problems:"
我该怎么做翻译“ 1错误禁止保存该产品:”? 哪个文件包含其文本?
我相信您只需要activerecord:
部分,如果您使用的是Rails2.x。 问题可能是您的最高水平不是语言。 从Rails 3.x(现在使用单独的dynamic_form
插件来处理此问题)开始,默认值为:
en:
errors:
template:
header:
one: "1 error prohibited this %{model} from being saved"
other: "%{count} errors prohibited this %{model} from being saved"
# The variable :count is also available
body: "There were problems with the following fields:"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.