Revert "i18n: Prevent data race in lang code handling"

This reverts commit c97216e4f0.
This commit is contained in:
Bjørn Erik Pedersen 2017-11-05 10:20:30 +01:00
parent c97216e4f0
commit b3443b3d0c
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 1 additions and 3 deletions

View file

@ -68,9 +68,7 @@ func (t Translator) initFuncs(bndl *bundle.Bundle) {
currentLang := lang currentLang := lang
t.translateFuncs[currentLang] = func(translationID string, args ...interface{}) string { t.translateFuncs[currentLang] = func(translationID string, args ...interface{}) string {
tpMu.RLock()
tFunc, err := bndl.Tfunc(currentLang) tFunc, err := bndl.Tfunc(currentLang)
tpMu.RUnlock()
if err != nil { if err != nil {
jww.WARN.Printf("could not load translations for language %q (%s), will use default content language.\n", lang, err) jww.WARN.Printf("could not load translations for language %q (%s), will use default content language.\n", lang, err)
} }

View file

@ -25,7 +25,7 @@ import (
// Unfortunately this needs to be global, see // Unfortunately this needs to be global, see
// https://github.com/nicksnyder/go-i18n/issues/82 // https://github.com/nicksnyder/go-i18n/issues/82
var tpMu sync.RWMutex var tpMu sync.Mutex
// TranslationProvider provides translation handling, i.e. loading // TranslationProvider provides translation handling, i.e. loading
// of bundles etc. // of bundles etc.