6e546facc0
- Fixed an error in the spanish and chinese translation file - Refactored reading the translation files Instead of ignoring errors in the non-default language files the error will now be returned and the remaining files will not be loaded. - Added a unit test to check if all translation files are valid - Added an i18n config to specify the translations dir and the default language
18 lignes
343 o
Go
18 lignes
343 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)
|
|
|
|
err := InitI18n(conf)
|
|
if err != nil {
|
|
t.Errorf("failed to initialize language translations: %v", err)
|
|
}
|
|
}
|