環境
PHP 7.3.10
Laravel 6.5.0
内容
laravelにコマンドで追加した認証処理とかを日本語化したい
やったこと
1.設定ファイルのlocaleをjaに変更
config/app.php
/*
|--------------------------------------------------------------------------
| 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',
2.コマンド実行
https://readouble.com/laravel/5.6/ja/validation-php.html
にある下記コマンドをコマンドプロンプト/VSCodeターミナルで実行するとディレクトリが作成される
(Windows環境ではまだ試していません。)とあるが問題なく可能
.sh
php -r "copy('https://readouble.com/laravel/5.6/ja/install-ja-lang-files.php', 'install-ja-lang.php');"
php -f install-ja-lang.php
php -r "unlink('install-ja-lang.php');"
3.jsonファイル追加
下記を追加して、それぞれの置き換え文言を追加していく
resources/lang/ja.json
{
"Register": "参加登録",
"Login": "ログイン",
"Name": "名前",
"E-Mail Address": "メールアドレス",
"Password": "パスワード",
"Confirm Password": "パスワード再入力",
"Remember Me": "ログイン情報を記録",
"Forgot Your Password?": "パスワード忘れの場合",
"Reset Password": "パスワードリセット",
"Send Password Reset Link": "パスワードリセットメールを送信",
"Verify Your Email Address": "メールアドレスを認証してください",
"A fresh verification link has been sent to your email address.": "新規の認証リンクを再度送信しました",
"Before proceeding, please check your email for a verification link.": "送信メール内の認証リンクをから認証を行ってください。",
"If you did not receive the email,": "メールが届いていない場合、",
"click here to request another.": "こちらクリックで再度メール送信します。"
}