DDR爱好者之家 Design By 杰米

1.覆盖提示信息:

打开resource/lang/en/validation.php注释掉英文提示信息

将下面的提示信息覆盖英文提示信息

<"attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
 
'custom' => [
  'attribute-name' => [
    'rule-name' => 'custom-message',
  ],
],
 
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
 
'attributes' => [
  // 'name'     => '名字',
  // 'age'     => '年龄',
],
 
];

2.安装中文信息提示包

composer require "overtrue/laravel-lang:~3.0"

注册服务提供者: config/app.php

'providers' => [
  // Illuminate\Translation\TranslationServiceProvider::class,
  Overtrue\LaravelLang\TranslationServiceProvider::class,
]

修改语言:config/app.php

'locale' => 'zh-CN',

以上这篇Laravel修改验证提示信息为中文的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米