From 95dac2ecf698230827975baf1fe7c8b6f246ddc3 Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 25 Nov 2021 09:37:27 +0800 Subject: [PATCH] upd(help): auto select current language --- src/renderer/plugins/status-bar-help.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderer/plugins/status-bar-help.ts b/src/renderer/plugins/status-bar-help.ts index a81a9033..bab3caac 100644 --- a/src/renderer/plugins/status-bar-help.ts +++ b/src/renderer/plugins/status-bar-help.ts @@ -3,19 +3,19 @@ import type { Plugin } from '@fe/context' export default { name: 'status-bar-help', register: ctx => { + const getDoc = (name: string) => ctx.i18n.getCurrentLanguage() === 'zh-CN' + ? `${name}_ZH-CN.md` + : `${name}.md` + const showHelpAction = ctx.action.registerAction({ name: 'plugin.status-bar-help.show-readme', keys: null, - handler: () => ctx.doc.showHelp( - ctx.i18n.getCurrentLanguage() === 'zh-CN' - ? 'README_ZH-CN.md' - : 'README.md' - ) + handler: () => ctx.doc.showHelp(getDoc('README')) }) const showFeaturesAction = ctx.action.registerAction({ name: 'plugin.status-bar-help.show-features', - handler: () => ctx.doc.showHelp('FEATURES.md'), + handler: () => ctx.doc.showHelp(getDoc('FEATURES')), keys: null }) @@ -27,7 +27,7 @@ export default { const showPluginAction = ctx.action.registerAction({ name: 'plugin.status-bar-help.show-plugin', - handler: () => ctx.doc.showHelp('PLUGIN.md'), + handler: () => ctx.doc.showHelp(getDoc('PLUGIN')), keys: null })