Ruby on rails Rails中的属性转换
因此,我几天前遇到的问题仍然使我无法使用代码。我无法为我的应用程序获得正确的翻译:Yml看起来像:Ruby on rails Rails中的属性转换,ruby-on-rails,internationalization,attributes,translation,Ruby On Rails,Internationalization,Attributes,Translation,因此,我几天前遇到的问题仍然使我无法使用代码。我无法为我的应用程序获得正确的翻译:Yml看起来像: pl: errors: &errors format: ! '%{attribute} %{message}' messages: confirmation: nie zgadza się z potwierdzeniem activemodel: errors: <<: *errors activere
pl:
errors: &errors
format: ! '%{attribute} %{message}'
messages:
confirmation: nie zgadza się z potwierdzeniem
activemodel:
errors:
<<: *errors
activerecord:
errors:
<<: *errors
module Account
class User < ActiveRecord::Base
attr_accessor: password_confirmation
end
end
我试着阅读了activerecord文档,并将前面的问题(,)堆积起来。但它仍然没有像我想要的那样工作。
密码确认仍然是“密码确认”,而不是应该的“Potwierdzenie hasła”。屏幕截图可以更好地解释这一点:您的用户模型位于名称空间中,因此您还必须在翻译文件中声明名称空间。请尝试以下操作以获得密码确认的正确翻译:
pl:
activerecord:
attributes:
account/user:
password_confirmation: "Potwierdzenie hasła"
pl:
activerecord:
attributes:
account/user:
password_confirmation: "Potwierdzenie hasła"