Skip to content

Commit e1adf00

Browse files
Merge pull request #68 from cedricferry/fix-help-button-show-english-documentation
Fixed Help button to show English document when localisation is english
2 parents 1babfe0 + 2c52e3d commit e1adf00

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/action/OpenDocAction.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ class OpenDocAction :
1313
override fun isEnable(e: AnActionEvent) = true
1414

1515
override fun actionPerformed(e: AnActionEvent) {
16+
val config = CodeLocatorUserConfig.loadConfig()
17+
val docUrl = if(config.isEnglish()) {
18+
NetUtils.DOC_URL_EN
19+
} else {
20+
NetUtils.DOC_URL
21+
}
1622
IdeaUtils.openBrowser(e.project, NetUtils.DOC_URL)
1723
Mob.mob(Mob.Action.CLICK, Mob.Button.DOC)
1824
}

CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/model/CodeLocatorUserConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ public void setAutoFormatCode(boolean autoFormatCode) {
448448
this.autoFormatCode = autoFormatCode;
449449
}
450450

451+
public boolean isEnglish() {
452+
return this.res == "en"
453+
}
454+
451455
@NotNull
452456
public static CodeLocatorUserConfig loadConfig() {
453457
if (sCodeLocatorConfig != null) {

CodeLocatorPlugin/src/main/java/com/bytedance/tools/codelocator/utils/NetUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class NetUtils {
1919

2020
public static final String DOC_URL = "https://github.com/bytedance/CodeLocator/blob/main/how_to_use_codelocator_zh.md";
2121

22+
public static final String DOC_URL_EN = "https://github.com/bytedance/CodeLocator/blob/main/how_to_use_codelocator.md";
23+
2224
public static final String SERVER_URL = "https://c76297c446.goho.co/log.php";
2325

2426
public static final String FILE_SERVER_URL = "https://c76297c446.goho.co/upload.php";

0 commit comments

Comments
 (0)