0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Laravelでエラーメッセージを日本語にする方法

0
Last updated at Posted at 2026-04-19

Laravelでエラーメッセージを日本語する方法を備忘録としてまとめておきます。
パッケージをインストールする一番簡単な方法です。

1.パッケージをインストール

composer require laravel-lang/common

2.日本語用のファイルを追加

php artisan lang:add ja

3. app.phpを修正

下記のようにlocaleをenからjaに変更します。

/*↓こいつだけ変更*/
'locale' => 'ja',

/*↓はこのまま*/
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),

fallback_localeは予備の言語設定だそうです。
enにしておくと日本語の翻訳データがない時に、英語で表示してくれます。

4. envファイルを修正

APP_LOCALE=ja

以上

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?