diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-10-21 11:17:48 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-10-22 09:09:29 +0200 |
commit | fdfa4a5fe62232f65f1dd8d6fe0c500374228788 (patch) | |
tree | b804e91506a7f3c58690c6fd774b28f95184d5dc /langs | |
parent | 8cbe2bbfad6aa4de267921e24e166d4addf47040 (diff) | |
download | hugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.tar.gz hugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.zip |
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')
-rw-r--r-- | langs/i18n/i18n.go | 10 |
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") { |