summaryrefslogtreecommitdiffstats
path: root/utils/i18n.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
commit5fa1b3581955761bd39c310bc88b1489d963a9fc (patch)
tree25e6dd11592102807abebbb5de100f7d867005d8 /utils/i18n.go
parent37f0e5e0ebc0595efe2c65ffb84fa096dc8c5493 (diff)
parent87762ae62eb887dfb3fd0957040919aede46f7d4 (diff)
downloadchat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.gz
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.bz2
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'utils/i18n.go')
-rw-r--r--utils/i18n.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/i18n.go b/utils/i18n.go
index 8ed82d19f..7b8d1fef0 100644
--- a/utils/i18n.go
+++ b/utils/i18n.go
@@ -23,13 +23,15 @@ var settings model.LocalizationSettings
// this functions loads translations from filesystem
// and assign english while loading server config
func TranslationsPreInit() error {
+ // Set T even if we fail to load the translations. Lots of shutdown handling code will
+ // segfault trying to handle the error, and the untranslated IDs are strictly better.
+ T = TfuncWithFallback("en")
+ TDefault = TfuncWithFallback("en")
+
if err := InitTranslationsWithDir("i18n"); err != nil {
return err
}
- T = TfuncWithFallback("en")
- TDefault = TfuncWithFallback("en")
-
return nil
}
@@ -51,9 +53,9 @@ func InitTranslationsWithDir(dir string) error {
for _, f := range files {
if filepath.Ext(f.Name()) == ".json" {
filename := f.Name()
- locales[strings.Split(filename, ".")[0]] = i18nDirectory + filename
+ locales[strings.Split(filename, ".")[0]] = filepath.Join(i18nDirectory, filename)
- if err := i18n.LoadTranslationFile(i18nDirectory + filename); err != nil {
+ if err := i18n.LoadTranslationFile(filepath.Join(i18nDirectory, filename)); err != nil {
return err
}
}