1
votes

So, I have custom view sessions/new.html.haml

I have a label in my form

    = f.label :login

How my en.yml should look like to replace Login with Email or Username

I included gem rails-i18n and tried

en:
   login: "Email or Username"

or

en:
   devise:
   sessions:
     new:
       login: Email or Username"

But it still doesn't work.

2

2 Answers

1
votes

Rails implements a convenient way to look up the locale inside views. When you have the following dictionary.

In locale folder.

locale
     en
       session
             new
               en.yml

In en.yml

en:
  sessions:
    new:
        login: "Email or Username"

In new.html.slim:

t.('.login')

This is I18n lazylookup

0
votes

Here is how you do that.

en:
  activerecord:
    models:
      user: "User"
    attributes:
      user:
        email: "Email"
        login: "Email or Username"
        password: "Password"
        password_confirmation: "Password confirmation"
        current_password: "Current password"
        remember_me: "Remember me"

And make sure your locale is 'en' not 'en-us'