From e25e8042bac73312ce3d3f07af918b21dc6f6f88 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 26 Oct 2024 21:36:08 +0800 Subject: [PATCH] :bug: The marketplace language does not change after switching the appearance language https://github.com/siyuan-note/siyuan/issues/12892 --- kernel/api/setting.go | 7 +++++++ kernel/bazaar/package.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/kernel/api/setting.go b/kernel/api/setting.go index a60c194a431..1d7d36ab601 100644 --- a/kernel/api/setting.go +++ b/kernel/api/setting.go @@ -23,6 +23,7 @@ import ( "github.com/88250/gulu" "github.com/gin-gonic/gin" + "github.com/siyuan-note/siyuan/kernel/bazaar" "github.com/siyuan-note/siyuan/kernel/conf" "github.com/siyuan-note/siyuan/kernel/model" "github.com/siyuan-note/siyuan/kernel/server/proxy" @@ -527,10 +528,16 @@ func setAppearance(c *gin.Context) { model.Conf.Appearance = appearance model.Conf.Lang = appearance.Lang + oldLang := util.Lang util.Lang = model.Conf.Lang model.Conf.Save() model.InitAppearance() + if oldLang != util.Lang { + // The marketplace language does not change after switching the appearance language https://github.com/siyuan-note/siyuan/issues/12892 + bazaar.CleanBazaarPackageCache() + } + ret.Data = model.Conf.Appearance } diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.go index 2a8cc6ab85b..d172678ced8 100644 --- a/kernel/bazaar/package.go +++ b/kernel/bazaar/package.go @@ -722,4 +722,8 @@ func disallowDisplayBazaarPackage(pkg *Package) bool { var packageCache = gcache.New(6*time.Hour, 30*time.Minute) // [repoURL]*Package +func CleanBazaarPackageCache() { + packageCache.Flush() +} + var packageInstallSizeCache = gcache.New(48*time.Hour, 6*time.Hour) // [repoURL]*int64