Reputation: 2597
I have registration in devise, look like this:
<%= 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>
And i try to translate devise with I18n, but with no results. When i put wrong password i see :
Password należy uzupełnić
Second half of it is translated but word "password" is not. I try many things like:
activerecord:
attributes:
user:
password: SHIT
but it doesn't work. Also try put it in :
errors: &errors
format: ! '%{attribute} %{message}'
messages:
but still it doesnt work. Also try with
formtastic:
user:
password:
but nothing works. Where i can translate words like: password, email, password_confirmation and other value from form.
And this is an answer:
activerecord:
attributes:
user:
password: Hasło
email: Adres email
password_confirmation: Hasło
profile:
age: Wiek
<<: *errors
Upvotes: 2
Views: 3345
Reputation: 4375
Simple check out the default en.yml translation file from devise to change the defaults:
https://github.com/plataformatec/devise/blob/master/config/locales/en.yml
Copy that file and create your own translations.. for example devise.de.yml, devise.es.yml and so on.. that should solve your problem.
If you´d like to translate your model attributes, it does not depend on devise. that´s normal rails stuff.. check out this link: http://guides.rubyonrails.org/i18n.html
Upvotes: 4