This commit is contained in:
Daniel 2025-04-01 14:34:12 +08:00
parent d0ad863651
commit 10c3d10145
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -134,7 +134,7 @@ func loadCode(petal *Petal) {
langJSONs, readErr := os.ReadDir(i18nDir)
if nil != readErr {
logging.LogErrorf("read plugin [%s] i18n failed: %s", petal.Name, readErr)
} else {
} else if 0 < len(langJSONs) {
preferredLang := Conf.Lang + ".json"
foundPreferredLang := false
foundEnUS := false
@ -166,7 +166,8 @@ func loadCode(petal *Petal) {
}
}
data, err = filelock.ReadFile(filepath.Join(i18nDir, preferredLang))
if langFilePath := filepath.Join(i18nDir, preferredLang); gulu.File.IsExist(langFilePath) {
data, err = filelock.ReadFile(langFilePath)
if err != nil {
logging.LogErrorf("read plugin [%s] i18n failed: %s", petal.Name, err)
} else {
@ -178,6 +179,7 @@ func loadCode(petal *Petal) {
}
}
}
}
var petalsStoreLock = sync.Mutex{}