Laravel表单验证提示设置多语言

Scroll Down

默认表单提示是英文的,我们可以安装语言包构建多语言环境。

根据版本选择命令

For Laravel 7.x : run composer require caouecs/laravel-lang:~6.0 
For Laravel 6.x : run composer require caouecs/laravel-lang:~5.0 
For Laravel 5.8 : run composer require caouecs/laravel-lang:~4.0 
For Laravel 5.1-5.7 : run composer require caouecs/laravel-lang:~3.0
For Laravel 5 : run composer require caouecs/laravel-lang:~2.0

扩展包含大多数语言,语言包位于vendor/caouecs/larvel-lang/src 目录中。

根据需要复制语言包到 resources/lang 目录中。

修改 config/app.php 配置文件

'locale' => 'zh-CN',