fully self-contained

paths are pretty janky, but it works. Also, [files]/lang_files now must
be the path to a directory CONTAINING a "lang/" directory. I'll work
around this at a later date.
This commit is contained in:
Harvey Tindall
2021-02-01 18:41:45 +00:00
parent 0330540f87
commit 815bdc35ac
8 changed files with 43 additions and 65 deletions
+6 -2
View File
@@ -120,6 +120,7 @@ func (st *Storage) loadLangSetup(filesystems ...fs.FS) error {
return err
}
english = st.lang.Setup["en-us"]
setupLoaded := false
for _, filesystem := range filesystems {
files, err := fs.ReadDir(filesystem, st.lang.SetupPath)
if err != nil {
@@ -128,11 +129,14 @@ func (st *Storage) loadLangSetup(filesystems ...fs.FS) error {
for _, f := range files {
if f.Name() != "en-us.json" {
err = load(filesystem, f.Name())
if err != nil {
return err
if err == nil {
setupLoaded = true
}
}
}
}
if !setupLoaded {
return err
}
return nil
}