laravel-lang icon indicating copy to clipboard operation
laravel-lang copied to clipboard

字段 验证提示 还是英文

Open gyp719 opened this issue 3 years ago • 4 comments

Laravel Framework 8.68.0

"overtrue/laravel-lang": "^5.0",

app.php 设置 'locale' => 'zh_CN', 验证 提示 是 phone 必须介于 3 - 10 个字符之间。 , 这个 phone 字段 在 validation-attributes.php 文件中 有定义, 没有 将 phone 提示为手机

猜测: validation-attributes.php validation-inline.php 都没有起作用

validation.php 文件中 添加

'attributes' => [
    'phone'         => '手机号',
],

这样 才有作用

gyp719 avatar Oct 27 '21 09:10 gyp719

官方文档的说法只有一种哦: https://laravel.com/docs/8.x/validation#specifying-attribute-in-language-files

overtrue avatar Oct 29 '21 06:10 overtrue

关于 validation-attributes.php 和 validation-inline.php 的问题,我看看 laravel-lang/lang 做了啥,官方貌似不支持这俩

overtrue avatar Oct 29 '21 06:10 overtrue

@gyp719 查了一下,这个变动比较大,需要改文件发布逻辑来合并这俩文件到 validation.php,暂时没时间改,推荐使用 https://github.com/ARCANEDEV/LaravelLang 或者 https://github.com/andrey-helldar/laravel-lang-publisher 来管理,他们的功能比较全

overtrue avatar Oct 29 '21 07:10 overtrue

@overtrue 好的,谢谢大佬。

gyp719 avatar Oct 29 '21 07:10 gyp719