根据大多数Google和SO的说法,Rails国际化问题的解决方案,特别是嵌套属性,是使用这种语法,带有正斜杠:
en:
activerecord:
attributes:
box/forwards:
source: "Origin"
以下内容:
Rails I18n accepts_nested_attributes_for and error_messages_for
这个Rails中的拉取请求(很久以前):
https://github.com/rails/rails/pull/3859
这对我不起作用。假设我在“盒子”模型中有以下安排:
has_many :forwards
accepts_nested_attributes_for :forwards, :reject_if => :all_blank, :allow_destroy => true
到目前为止,我已经尝试过了:
en:
activerecord:
attributes:
forward:
source: "ABC"
forwards:
source: "CDF"
box:
forward:
source: "SDS"
box:
forwards:
source: "SDS"
box/forward:
source: "BBB"
box/forwards:
source: "BBB"
在Rails 4.1.6中,如何改变en.yml中的嵌套字段名称?