cd844aec45
This consolidates the places where a default language has to be set. - Removed import of the 'userService' package into the 'languages' util package This was required to prevent a cyclic import between the two packages. - Added a 'UserRetriever' interface to read the language setting of users inside the 'languages' package
19 lignes
427 o
Go
19 lignes
427 o
Go
package languages
|
|
|
|
import (
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/ewhal/nyaa/config"
|
|
)
|
|
|
|
func TestInitI18n(t *testing.T) {
|
|
conf := config.DefaultI18nConfig
|
|
conf.TranslationsDirectory = path.Join("..", "..", conf.TranslationsDirectory)
|
|
var retriever UserRetriever = nil // not required during initialization
|
|
|
|
err := InitI18n(conf, retriever)
|
|
if err != nil {
|
|
t.Errorf("failed to initialize language translations: %v", err)
|
|
}
|
|
}
|