[英]How to translate default error messages in rails?
This not worked for me when i tried to change error_messages_for messages in translation.yml file: 当我尝试更改translation.yml文件中的error_messages_for消息时,这对我不起作用:
activerecord:
errors:
template:
header:
one: "Oops error"
other: "Many errors"
body: "There were problems:"
What can i do to translate "1 error prohibited this product from being saved:"? 我该怎么做翻译“ 1错误禁止保存该产品:”? What file contain their text?
哪个文件包含其文本?
I believe you only need the activerecord:
part if you're on Rails 2.x. 我相信您只需要
activerecord:
部分,如果您使用的是Rails2.x。 The problem may be that your top level wasn't a language. 问题可能是您的最高水平不是语言。 As of Rails 3.x (which uses the separate
dynamic_form
plugin now to handle this), the defaults are: 从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.