currentLang := lang
t.translateFuncs[currentLang] = func(translationID string, args ...interface{}) string {
- tpMu.RLock()
tFunc, err := bndl.Tfunc(currentLang)
- tpMu.RUnlock()
if err != nil {
jww.WARN.Printf("could not load translations for language %q (%s), will use default content language.\n", lang, err)
}
// Unfortunately this needs to be global, see
// https://github.com/nicksnyder/go-i18n/issues/82
-var tpMu sync.RWMutex
+var tpMu sync.Mutex
// TranslationProvider provides translation handling, i.e. loading
// of bundles etc.