mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 14:32:34 +08:00
🎨 Improve petal loading https://github.com/siyuan-note/bazaar/pull/1546
This commit is contained in:
parent
d0ad863651
commit
10c3d10145
@ -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{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user