loading...

How to localize f.label by i18n in Rails (日本語化)

twitter logo github logo ・1 min read

1. add two lines to config/application.rb

    config.i18n.default_locale = :ja
    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]

2. create new file on config/locales/

I named the file models.ja.yml.

ja:
  activerecord:
    models:
      user: ユーザー
      admin: 管理者
      medium: メディア
    attributes:
      user:
        id: ID
        email: メールアドレス
        password: パスワード
        password_confirmation: パスワードの確認
        current_password: 現在のパスワード
        remember_me: ログイン状態を記憶する
      admin:
        id: ID
      medium:
        media: メディア
twitter logo DISCUSS
Classic DEV Post from Jun 15 '19

Know Not Only Your Weaknesses, But Strengths as Well

Most people want to develop self-awareness. Whether we are managers, entrepreneurs, or aspiring software engineers, the more knowledge we have of our strength and weaknesses, the easier life becomes.

n350071 profile image
Ruby Web Developer. Freelancer.