package i18n import ( "unicode" ut "github.com/go-playground/universal-translator" "github.com/go-playground/validator/v10" ) func FormatValidateErrors(errors error, trans ut.Translator) map[string]string { formatted := make(map[string]string) if errors != nil { for _, err := range errors.(validator.ValidationErrors) { r := []rune(err.Translate(trans)) r[0] = unicode.ToUpper(r[0]) formatted[err.StructNamespace()] = string(r) } } return formatted }