I encountered some problem while trying to translate my model's names and attributes in a Rails 2.3.5 app.
I have the following model:
class BillingPlan < ActiveRecord::Base
validates_presence_of :billing_option_id
belongs_to :order
belongs_to :user
belongs_to :billing_option
end
When validation fails, my models attributes are translated correctly, but the modelname itself is not. I use the following translation skeleton in de.yml
de:
activerecord:
models:
shipping_plan: "Versandart"
billing_plan: "Rechnungsart"
attributes:
shipping_plan:
shipping_option_id: "Versandoption"
billing_plan:
billing_option_id: "Rechnungsoption"
Basis for my translation file is: http://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/de.yml
Can anyone help?
Thx in advance J. 开发者_StackOverflow
try to check your translations for active record models, look at the i18n documentation, 5.1.3 section on the Rails Guides (http://guides.rubyonrails.org/i18n.html)
by default rails uses this, you should create one for your 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:"
精彩评论