我在嘗試在Rails 2.3.5應用程序中轉換模型的名稱和屬性時遇到了一些問題。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
驗證失敗時,我的模型屬性翻譯正確,但MODELNAME本身是沒有的。我用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.
如何調用錯誤? '通過error_message_for'? – shingara 2010-05-31 16:57:26
這裏變得更加混亂。我對大多數表格都使用formtastic,但也必須使用標準表格。 如果我使用類似formtastic: <%semantic_form_for @user do | f | %> <%= f.error_messages%> ... <% end %>一切都翻譯得很好。 如果是標準格式: <%form_for @billing_plan do | f | %> <%= f.error_messages%> ... <% end %>我仍然有模型名稱未翻譯的問題。 – 2010-05-31 20:35:11