【发布时间】:2013-08-20 11:48:06
【问题描述】:
我已经在设计中注册了,如下所示:
<%= semantic_form_for resource, :as => resource_name, :url => registration_path(resource_name) do |f| %>
<li id='errors'><%= devise_error_messages! %></li>
<span><%= f.label :email ,'Adres email' %></span>
<li><%= f.email_field :email %></li>
<span><%= f.label :password ,'Hasło' %></span>
<li><%= f.password_field :password %></li>
我尝试用 I18n 翻译设计,但没有结果。当我输入错误的密码时,我看到:
Password należy uzupełnić
它的后半部分已翻译,但“密码”一词未翻译。我尝试了很多事情,例如:
activerecord:
attributes:
user:
password: SHIT
但它不起作用。也试试把它放进去:
errors: &errors
format: ! '%{attribute} %{message}'
messages:
但它仍然不起作用。也可以尝试
formtastic:
user:
password:
但没有任何效果。我可以在哪里翻译诸如密码、电子邮件、密码确认和表单中的其他值之类的词。
这是一个答案:
activerecord:
attributes:
user:
password: Hasło
email: Adres email
password_confirmation: Hasło
profile:
age: Wiek
<<: *errors
【问题讨论】:
-
不要理解 - 我如何在标签视图中设置 devise_errors
-
抱歉误会了。忽略它。
-
你使用的是devise i18n文件吗?
-
AFAIK 如果你在
form_for中有resource,那么你应该在语言环境中为resource添加属性,现在你在表单中有resource,在语言环境中有user。跨度> -
好的,我得到了答案。用户和个人资料的 Activerecord 属性