summaryrefslogtreecommitdiffstats
path: root/langs/i18n
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-21 11:17:48 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-22 09:09:29 +0200
commitfdfa4a5fe62232f65f1dd8d6fe0c500374228788 (patch)
treeb804e91506a7f3c58690c6fd774b28f95184d5dc /langs/i18n
parent8cbe2bbfad6aa4de267921e24e166d4addf47040 (diff)
Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
Diffstat (limited to 'langs/i18n')
-rw-r--r--langs/i18n/i18n.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/langs/i18n/i18n.go b/langs/i18n/i18n.go
index c0eac5837..31cb5d732 100644
--- a/langs/i18n/i18n.go
+++ b/langs/i18n/i18n.go
@@ -35,11 +35,11 @@ var (
type Translator struct {
translateFuncs map[string]translateFunc
cfg config.Provider
- logger *loggers.Logger
+ logger loggers.Logger
}
// NewTranslator creates a new Translator for the given language bundle and configuration.
-func NewTranslator(b *i18n.Bundle, cfg config.Provider, logger *loggers.Logger) Translator {
+func NewTranslator(b *i18n.Bundle, cfg config.Provider, logger loggers.Logger) Translator {
t := Translator{cfg: cfg, logger: logger, translateFuncs: make(map[string]translateFunc)}
t.initFuncs(b)
return t
@@ -51,12 +51,12 @@ func (t Translator) Func(lang string) translateFunc {
if f, ok := t.translateFuncs[lang]; ok {
return f
}
- t.logger.INFO.Printf("Translation func for language %v not found, use default.", lang)
+ t.logger.Infof("Translation func for language %v not found, use default.", lang)
if f, ok := t.translateFuncs[t.cfg.GetString("defaultContentLanguage")]; ok {
return f
}
- t.logger.INFO.Println("i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.")
+ t.logger.Infoln("i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.")
return func(translationID string, args interface{}) string {
return ""
}
@@ -98,7 +98,7 @@ func (t Translator) initFuncs(bndl *i18n.Bundle) {
}
if _, ok := err.(*i18n.MessageNotFoundErr); !ok {
- t.logger.WARN.Printf("Failed to get translated string for language %q and ID %q: %s", currentLangStr, translationID, err)
+ t.logger.Warnf("Failed to get translated string for language %q and ID %q: %s", currentLangStr, translationID, err)
}
if t.cfg.GetBool("logI18nWarnings") {