1

遇到关联时,我有一个关于 i18n in rails 的问题

class User
  belongs_to :billing_address, :class_name => "Address'
  belongs_to :delivery_address, :class_name => "Address'
end

en:
  activerecord:
    attributes:
      user:
        billing_address_id: "billing address"
        delivery_address_id: "delivery address"

上面的代码有效,但我想知道是否有另一种方法可以通过不在_idyml 中使用后缀来实现这一点?

4

1 回答 1

0

你正朝着正确的方向前进。这会好一点:

en:
  activerecord:
    models:
      address: 'Address'
      user: 'User'
    attributes:
      address:
        city: 'City'
        zip_code: 'ZIP code'
      user:
        address_id: 'Address ID'

看看http://xyzpub.com/en/ruby-on-rails/3.2/i18n_mehrspra​​chige_rails_applikation.html

于 2013-04-04T12:16:56.810 回答