fix for aliases

pull/975/head
Gleb 2 years ago committed by glebmalcev
parent 9e2ea40380
commit 4f6acec017
  1. 8
      errors.go

@ -260,15 +260,19 @@ func (fe *fieldError) Error() string {
// NOTE: if no registered translation can be found, it returns the original // NOTE: if no registered translation can be found, it returns the original
// untranslated error message. // untranslated error message.
func (fe *fieldError) Translate(ut ut.Translator) string { func (fe *fieldError) Translate(ut ut.Translator) string {
var fn TranslationFunc
m, ok := fe.v.transTagFunc[ut] m, ok := fe.v.transTagFunc[ut]
if !ok { if !ok {
return fe.Error() return fe.Error()
} }
fn, ok := m[fe.tag] fn, ok = m[fe.tag]
if !ok { if !ok {
return fe.Error() fn, ok = m[fe.actualTag]
if !ok {
return fe.Error()
}
} }
return fn(ut, fe) return fn(ut, fe)

Loading…
Cancel
Save