fix for aliases

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

@ -260,16 +260,20 @@ 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 {
fn, ok = m[fe.actualTag]
if !ok { if !ok {
return fe.Error() return fe.Error()
} }
}
return fn(ut, fe) return fn(ut, fe)
} }

Loading…
Cancel
Save