我在尝试在Rails 2.3.5应用程序中翻译我的模型的名称和属性时遇到了一些问题。
我有以下型号:
class BillingPlan < ActiveRecord::Base
validates_presence_of :billing_option_id
belongs_to :order
belongs_to :user
belongs_to :billing_option
end
验证失败时,我的模型属性被正确翻译,但模型名本身不是。我在de.yml中使用以下翻译骨架
de:
activerecord:
models:
shipping_plan: "Versandart"
billing_plan: "Rechnungsart"
attributes:
shipping_plan:
shipping_option_id: "Versandoption"
billing_plan:
billing_option_id: "Rechnungsoption"
我的翻译文件的基础是:http://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/de.yml
有人可以帮忙吗?
提前谢谢 J.答案 0 :(得分:0)
尝试检查有关活动记录模型的翻译,查看有关Rails指南(http://guides.rubyonrails.org/i18n.html)的i18n文档,5.1.3部分
默认情况下rails使用它,你应该为你的de i18n创建一个:
en:
activerecord:
errors:
template:
header:
one: "1 error prohibited this {{model}} from being saved"
other: "{{count}} errors prohibited this {{model}} from being saved"
body: "There were problems with the following fields:"