PLT-3456 Fix Errors while starting the server (#3445)
* PLT-3456 AppErrors that are triggered before translations are loaded crash server or produce bad error messages. * Fixing tests
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
5dfa4fb629
Коммит
2305b2597f
@@ -15,9 +15,16 @@ var T i18n.TranslateFunc
|
||||
var locales map[string]string = make(map[string]string)
|
||||
var settings model.LocalizationSettings
|
||||
|
||||
// this functions loads translations from filesystem
|
||||
// and assign english while loading server config
|
||||
func TranslationsPreInit() {
|
||||
InitTranslationsWithDir("i18n")
|
||||
T = TfuncWithFallback("en")
|
||||
}
|
||||
|
||||
func InitTranslations(localizationSettings model.LocalizationSettings) {
|
||||
settings = localizationSettings
|
||||
InitTranslationsWithDir("i18n")
|
||||
T = GetTranslationsBySystemLocale()
|
||||
}
|
||||
|
||||
func InitTranslationsWithDir(dir string) {
|
||||
@@ -30,8 +37,6 @@ func InitTranslationsWithDir(dir string) {
|
||||
i18n.MustLoadTranslationFile(i18nDirectory + filename)
|
||||
}
|
||||
}
|
||||
|
||||
T = GetTranslationsBySystemLocale()
|
||||
}
|
||||
|
||||
func GetTranslationsBySystemLocale() i18n.TranslateFunc {
|
||||
|
||||
Ссылка в новой задаче
Block a user