10
5

More than 3 years have passed since last update.

Laravel7を日本語化する方法

Posted at

Laravel5,6,7に対応。
ログイン画面や、エラーメッセージ、確認メールなどを日本語化します:blush:

Laravelはデフォルトでは以下のような英語表記になっています。
これを日本語にしていきます。

スクリーンショット 2020-05-08 15.54.36.png

app.phpの設定を変更する

プロジェクトフォルダのconfig/app.phpの'locale' => 'en'を'locale' => 'ja'に変更する。

    /*
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    */

    'locale' => 'ja',

GitHubからダウンロードする

以下からZipファイルをダウンロードします。
https://github.com/caouecs/Laravel-lang

ダウンロードが終わったら、解凍してください。

ファイルを配置する

  1. 解凍したLaravel-lang-masterフォルダのjson/ja.jsonを、プロジェクトフォルダの resources/langに移動
  2. Laravel-lang-master/src内のjaフォルダを、プロジェクト内のresources/langに移動 スクリーンショット 2020-05-08 16.09.20.png

日本語化完了!

ブラウザで確認してみてください:blush:
無事、日本語化できました。
スクリーンショット 2020-05-08 16.10.49.png

10
5
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
10
5