From 4f6acec017be5b5527d3f2e7cc2a2c69c204eb6d Mon Sep 17 00:00:00 2001 From: Gleb <49669778+maltsev25@users.noreply.github.com> Date: Thu, 7 Jul 2022 21:20:37 +0300 Subject: [PATCH] fix for aliases --- errors.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/errors.go b/errors.go index 9a1b1ab..c9e419f 100644 --- a/errors.go +++ b/errors.go @@ -260,15 +260,19 @@ func (fe *fieldError) Error() string { // NOTE: if no registered translation can be found, it returns the original // untranslated error message. func (fe *fieldError) Translate(ut ut.Translator) string { + var fn TranslationFunc m, ok := fe.v.transTagFunc[ut] if !ok { return fe.Error() } - fn, ok := m[fe.tag] + fn, ok = m[fe.tag] if !ok { - return fe.Error() + fn, ok = m[fe.actualTag] + if !ok { + return fe.Error() + } } return fn(ut, fe)