Gin模型数据绑定验证器用的是go-playground/validator/v10。默认提示是英文内容,我们需要翻译成中文内容。
创建一个文件`validator.go`:
```go
package utils
import (
"github.com/gin-gonic/gin/binding"
"github.com/go-playground/locales/en"
"github.com/go-playground/locales/zh"
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
zhtranslat...
发布日期:
2021-12-08
分类:
Go
浏览量:
1515
0条评论