From e9f45cf3afc99cc094d02f27c38abdb4adee9d2d Mon Sep 17 00:00:00 2001 From: sunyuqiang <1129921824@qq.com> Date: Tue, 1 Aug 2023 17:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E7=95=8C=E9=9D=A2=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/search.vue | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/renderer/components/search.vue b/src/renderer/components/search.vue index 5e9fbf5..ed0d88e 100644 --- a/src/renderer/components/search.vue +++ b/src/renderer/components/search.vue @@ -162,6 +162,26 @@ const showSeparate = () => { label: config.value.perf.common.hideOnBlur ? '钉住' : '自动隐藏', click: changeHideOnBlur, }, + { + label: + config.value.perf.common.lang === 'zh-CN' + ? '切换语言' + : 'Change Language', + submenu: [ + { + label: '简体中文', + click: () => { + changeLang('zh-CN'); + }, + }, + { + label: 'English', + click: () => { + changeLang('en-US'); + }, + }, + ], + }, ]; if (props.currentPlugin && props.currentPlugin.logo) { pluginMenu = pluginMenu.concat([ @@ -193,6 +213,13 @@ const showSeparate = () => { menu.popup(); }; +const changeLang = (lang) => { + let cfg = { ...config.value }; + cfg.perf.common.lang = lang; + opConfig.set(cfg); + config.value = cfg; +}; + const changeHideOnBlur = () => { let cfg = { ...config.value }; cfg.perf.common.hideOnBlur = !cfg.perf.common.hideOnBlur;