Devise attributes for i18n?

2019-06-27 12:18发布

问题:

How can I translate the attributes of Devise's models? E.g. session.email or session.remember_me.

Both hierarchies

de:
  devise:
    sessions:
      email: "E-Mail"

and

de:
  activerecord:
    attributes:
      session:
        email: "E-Mail"

do not work. What is the right identifier?

回答1:

I stumbled upon the solution by myself: I have to define the model names in the namespace of simple_form as described here: https://github.com/plataformatec/simple_form (bottom).



回答2:

The Devise I18n config files are for flash messages and subject titles to emails. You need to generate the views and modify them accordingly with:

rails generate devise:views