From 2c52e3d3299044992bbe905ddc2dc35ba51c07cb Mon Sep 17 00:00:00 2001 From: Cedric <124741426+cedricferry@users.noreply.github.com> Date: Wed, 7 Aug 2024 15:18:11 +1000 Subject: [PATCH] * fixed Help button to show English document when localisation is english --- .../com/bytedance/tools/codelocator/action/OpenDocAction.kt | 6 ++++++ .../tools/codelocator/model/CodeLocatorUserConfig.java | 4 ++++ .../com/bytedance/tools/codelocator/utils/NetUtils.java | 2 ++ 3 files changed, 12 insertions(+) diff --git a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/action/OpenDocAction.kt b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/action/OpenDocAction.kt index fbd75da..8eed3c9 100644 --- a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/action/OpenDocAction.kt +++ b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/action/OpenDocAction.kt @@ -13,6 +13,12 @@ class OpenDocAction : override fun isEnable(e: AnActionEvent) = true override fun actionPerformed(e: AnActionEvent) { + val config = CodeLocatorUserConfig.loadConfig() + val docUrl = if(config.isEnglish()) { + NetUtils.DOC_URL_EN + } else { + NetUtils.DOC_URL + } IdeaUtils.openBrowser(e.project, NetUtils.DOC_URL) Mob.mob(Mob.Action.CLICK, Mob.Button.DOC) } diff --git a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/model/CodeLocatorUserConfig.java b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/model/CodeLocatorUserConfig.java index 0b85edb..0cff8c2 100644 --- a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/model/CodeLocatorUserConfig.java +++ b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/model/CodeLocatorUserConfig.java @@ -448,6 +448,10 @@ public void setAutoFormatCode(boolean autoFormatCode) { this.autoFormatCode = autoFormatCode; } + public boolean isEnglish() { + return this.res == "en" + } + @NotNull public static CodeLocatorUserConfig loadConfig() { if (sCodeLocatorConfig != null) { diff --git a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/utils/NetUtils.java b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/utils/NetUtils.java index c41b225..4145303 100644 --- a/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/utils/NetUtils.java +++ b/CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/utils/NetUtils.java @@ -19,6 +19,8 @@ public class NetUtils { public static final String DOC_URL = "https://github.com/bytedance/CodeLocator/blob/main/how_to_use_codelocator_zh.md"; + public static final String DOC_URL_EN = "https://github.com/bytedance/CodeLocator/blob/main/how_to_use_codelocator.md"; + public static final String SERVER_URL = "https://c76297c446.goho.co/log.php"; public static final String FILE_SERVER_URL = "https://c76297c446.goho.co/upload.php";