Mic*_*ski 10 translation ruby-on-rails mongodb mongoid ruby-on-rails-3
我有mongoid和模型翻译的问题.当我尝试在我的模型上使用mongoDB时,我不知道要翻译属性和模型名称.它通常在*.yml文件中,但在这个时候这不起作用.有任何想法吗?
小智 14
变体与"activemodel"对我不起作用.但.
这个变种对我有用:
en:
mongoid:
errors:
models:
user:
attributes:
email:
blank: "You have to give me your e-mail address"
not_found: "e-mail address not found in list of members"
#...
attributes:
user:
email: "Email address"
name: "Your nickname"
#...
Run Code Online (Sandbox Code Playgroud)
小智 7
在yml文件中尝试这个(在我的例子中是config/locales/pt-BR.yml):
activemodel:
attributes:
[model_name]:
[attribute1]: "[translation1]"
[attribute2]: "[translation2]"
[attribute3]: "[translation3]"
Run Code Online (Sandbox Code Playgroud)
为我工作,使用mongoid 2.0.0.beta.17和rails 3.0.0
| 归档时间: |
|
| 查看次数: |
3556 次 |
| 最近记录: |