From ca209a04b17c8a0b54194cd65985b6cb131a0c95 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Mon, 18 Mar 2024 12:41:31 +0100 Subject: [PATCH] log.Error on missing translation --- modules/translation/i18n/localestore.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/translation/i18n/localestore.go b/modules/translation/i18n/localestore.go index 44c3fb0c88..0e6ddab401 100644 --- a/modules/translation/i18n/localestore.go +++ b/modules/translation/i18n/localestore.go @@ -114,16 +114,22 @@ func (l *locale) TrString(trKey string, trArgs ...any) string { format := trKey idx, ok := l.store.trKeyToIdxMap[trKey] + found := false if ok { if msg, ok := l.idxToMsgMap[idx]; ok { format = msg // use the found translation + found = true } else if def, ok := l.store.localeMap[l.store.defaultLang]; ok { // try to use default locale's translation if msg, ok := def.idxToMsgMap[idx]; ok { format = msg + found = true } } } + if !found { + log.Error("Missing translation %q", trKey) + } msg, err := Format(format, trArgs...) if err != nil {