1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Railsで使える日本語翻訳ファイル `ja.yml` の例

Posted at

Railsアプリで Devise やビューに日本語を表示させるには、
config/locales/ja.yml を作成し、以下のように記述します:

ja:
  hello: "こんにちは"

  devise:
    shared:
      links:
        sign_in: "ログイン"
        sign_up: "サインアップ"
        forgot_password: "パスワードを忘れた方はこちら"

    sessions:
      new:
        sign_in: "ログイン"

    registrations:
      new:
        sign_up: "新規登録"

これを用意しておくと、ビュー側では次のように使えます:

= link_to t("devise.shared.links.sign_in"), new_session_path(resource_name)

これで、日本語対応もばっちり!🌸


1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?