go-playground / locales

:earth_americas: a set of locales generated from the CLDR Project which can be used independently or within an i18n package; these were built for use with, but not exclusive to https://github.com/go-playground/universal-translator
MIT License
268 stars 55 forks source link

no translation tag(`validate:"unique"`) #39

Open atopx opened 3 years ago

atopx commented 3 years ago

definition


import (
    "github.com/go-playground/locales/zh_Hans_CN"
    "github.com/go-playground/validator/v10/translations/zh"
)

// ...

rans, _ = ut.New(zh_Hans_CN.New()).GetTranslator("zh")

type Test struct {
    Urls     []string `json:"urls" validate:"unique" label:"urls"`
}

output

Key: 'Test.urls' Error:Field validation for 'urls' failed on the 'unique' tag