I tried the following:
我尝试了以下方法:
es:
activerecord:
attributes:
name: Nombre
And it did not work.
它没有用。
But the following do work:
但以下工作:
es:
activerecord:
attributes:
person:
name: Nombre
Which is the correct way to define default attributes across models?
哪种是跨模型定义默认属性的正确方法?
Also I'm using Formtastic and Active Admin.
我也在使用Formtastic和Active Admin。
3 个解决方案
#1
7
this is how im doing. Not perfect but will do the job.
这就是我在做的事情。不完美,但会完成这项工作。
activerecord:
attributes:
attribute_commons: &commons
name: Nome
description: Descrição
user:
<<: *commons
role:
<<: *commons
level: Nível
product:
<<: *commons
size: Tamanho
#2
26
Move the common attributes
up one level:
将公共属性向上移动一级:
es:
attributes:
name: Nombre
activerecord:
attributes:
user:
birthday: Etc
例
#3
1
If you are using yaml to store your tranlation, you should look for aliases and anchors in the yaml references : http://yaml.org/spec/1.2/spec.html
如果您使用yaml来存储您的翻译,您应该在yaml引用中查找别名和锚点:http://yaml.org/spec/1.2/spec.html
but it is not perfect at all. eg :
但它根本不完美。例如:
bill-to: &id001
street: |
123 Tornado Alley
Suite 16
city: East Centerville
state: KS
ship-to: *id001
#1
7
this is how im doing. Not perfect but will do the job.
这就是我在做的事情。不完美,但会完成这项工作。
activerecord:
attributes:
attribute_commons: &commons
name: Nome
description: Descrição
user:
<<: *commons
role:
<<: *commons
level: Nível
product:
<<: *commons
size: Tamanho
#2
26
Move the common attributes
up one level:
将公共属性向上移动一级:
es:
attributes:
name: Nombre
activerecord:
attributes:
user:
birthday: Etc
例
#3
1
If you are using yaml to store your tranlation, you should look for aliases and anchors in the yaml references : http://yaml.org/spec/1.2/spec.html
如果您使用yaml来存储您的翻译,您应该在yaml引用中查找别名和锚点:http://yaml.org/spec/1.2/spec.html
but it is not perfect at all. eg :
但它根本不完美。例如:
bill-to: &id001
street: |
123 Tornado Alley
Suite 16
city: East Centerville
state: KS
ship-to: *id001