Revert "i18n: Prevent data race in lang code handling"
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 5 Nov 2017 09:20:30 +0000 (10:20 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 5 Nov 2017 09:20:30 +0000 (10:20 +0100)
This reverts commit c97216e4f0f3021b12cd3803e512393be569c886.

i18n/i18n.go
i18n/translationProvider.go

index 6cc3d0b3388ddcde99ed07e160432a64fbb5b7c0..73417fb3240cdb32c9b7f12bea2c47e643be2d69 100644 (file)
@@ -68,9 +68,7 @@ func (t Translator) initFuncs(bndl *bundle.Bundle) {
                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)
                        }
index 556ee7a925e917050752db183cbba78ec3f4f5be..663a8dd5e0d15dff82af971e4047f96c4e4d78e3 100644 (file)
@@ -25,7 +25,7 @@ import (
 
 // 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.