简体   繁体   English

翻译activerecord属性

[英]Translate activerecord attributes

I saw a lot of topics on Stack but still can't find solution. 我在Stack上看到了很多主题,但仍然找不到解决方案。 I had to translate my model attribute so I followed: 我必须翻译我的模型属性,所以我遵循:

Translations for Active Record Models 活动记录模型的翻译

I want get something like this: "Pozycja nie może być puste" <= "%{attribute} %{message} 我想要得到这样的东西:“ Pozycja niemożebyćpuste” <=“%{attribute}%{message}

attribute => position 属性=>位置
message => nie może być puste" message => niemożebyćpuste”

So I built this but it isn't working. 所以我建立了这个,但是没有用。 How setup this interpolation? 如何设置该插值?

errors:
  format: "%{attribute} %{message}"
    messages:
      blank: "nie może być puste"

activerecord:
  models:
    user: 
      attributes:
        position: "Pozycja"

The keys hierarchy should be proper, 密钥层次结构应该适当,

It should be like this 应该是这样

pl:
  errors:
    format: "%{attribute} %{message}"
      messages:
        blank: "nie może być puste"

  activerecord:
    attributes:
      user: 
        position: "Pozycja"

For more you can always refer rails en.yml 有关更多信息,您可以随时参考rails en.yml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM