参考 https://github.com/caouecs/Laravel-lang 安装语言包;
1 For Laravel 5.8-6.0 : run composer require caouecs/laravel-lang:~4.0 in your project folder 2 For Laravel 5.1-5.7 : run composer require caouecs/laravel-lang:~3.0 in your project folder 3 For Laravel 5 : run composer require caouecs/laravel-lang:~2.0 in your project folder 4 For Laravel 4 : run composer require caouecs/laravel-lang:~1.0 in your project folder 5 Files of languages are in "vendor/caouecs/laravel-lang" directory 6 Copy the folders of languages that you want, in the resources/lang folder of your Laravel application (app/lang in Laravel 4).
打开 config/app.php文件 修改:
1 //略 2 'locale' => 'zh-CN', //系统预设语言 3 //略 4 'fallback_locale' => 'zh-CN', //如果使用者设置的值找不到,则采用此处设定的值 5 //略 6 'faker_locale' => 'zh_CN', //生成假资料的预设语言
1 php artisan config:cache
另外,如果有需要自定义翻译的,打开
resources/lang/zh-CN/validation.php文件:
1 'attributes' => [ 2 ... 3 'birthday' => '生日', 4 'fix' => '修理记录', 5 ]