[英]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.