|
|
@ -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) |
|
|
|