Home >Backend Development >PHP Tutorial >How to display the Chinese name of the field in laravel form error message?
nickname is so unfriendly
This tutorial teaches you how to write it
nickname is so unfriendly
This tutorial teaches you how to write it
Then write them separately
<code>'start.required'=>'请填写开始时间', 'type.required'=>'请填写数据的分类',</code>
Three methods:
1. Use trans()
to write, write the Chinese name of the field to /resources/lang/zh-CN/auth.php
, and then use it, refer to Laravel 5.2 documentation - Localization :
2. Add the Chinese name to the data table related fields in the data table migration file: ->comment('Chinese name');
, refer to Laravel 5.2 document - Migration (but how to get the value of comment, I I haven’t seen it in the document yet)
3.The last method is to install the laravel-lang expansion package, it comes with Chinese form verification prompts, highly recommended! Remember to change locale
to "zh-CN"
in config/app.php
.