From be9efbe6ee0d12fd96074dcc64f3305666538e77 Mon Sep 17 00:00:00 2001 From: ENC_Euphony <47242104+pynickle@users.noreply.github.com> Date: Sun, 10 Aug 2025 15:06:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=AC=20Wiki=20?= =?UTF-8?q?=E6=98=A0=E5=B0=84=20(#4211)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com> --- .../hmcl/ui/download/VersionsPage.java | 52 +++++++++++++++++-- .../resources/assets/lang/I18N.properties | 4 +- .../resources/assets/lang/I18N_es.properties | 4 +- .../resources/assets/lang/I18N_ja.properties | 3 ++ .../resources/assets/lang/I18N_ru.properties | 4 +- .../resources/assets/lang/I18N_zh.properties | 4 +- .../assets/lang/I18N_zh_CN.properties | 4 +- 7 files changed, 62 insertions(+), 13 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java index ac80067fb..8bd6dfcfa 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java @@ -409,22 +409,23 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres } if (remoteVersion instanceof GameRemoteVersion) { + String wikiSuffix = getWikiUrlSuffix(remoteVersion.getGameVersion()); switch (remoteVersion.getVersionType()) { case RELEASE: content.getTags().setAll(i18n("version.game.release")); content.setImage(VersionIconType.GRASS.getIcon()); - content.setExternalLink(i18n("wiki.version.game.release", remoteVersion.getGameVersion())); + content.setExternalLink(i18n("wiki.version.game", wikiSuffix)); break; case PENDING: case SNAPSHOT: content.getTags().setAll(i18n("version.game.snapshot")); content.setImage(VersionIconType.COMMAND.getIcon()); - content.setExternalLink(i18n("wiki.version.game.snapshot", remoteVersion.getGameVersion())); + content.setExternalLink(i18n("wiki.version.game", wikiSuffix)); break; default: content.getTags().setAll(i18n("version.game.old")); content.setImage(VersionIconType.CRAFT_TABLE.getIcon()); - content.setExternalLink(null); + content.setExternalLink(i18n("wiki.version.game", wikiSuffix)); break; } } else { @@ -452,5 +453,50 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres content.setExternalLink(null); } } + + private String getWikiUrlSuffix(String gameVersion) { + String id = gameVersion.toLowerCase(Locale.ROOT); + + switch (id) { + case "0.30-1": + case "0.30-2": + case "c0.30_01c": + return i18n("wiki.version.game.search", "Classic_0.30"); + case "in-20100206-2103": + return i18n("wiki.version.game.search", "Indev_20100206"); + case "inf-20100630-1": + return i18n("wiki.version.game.search", "Infdev_20100630"); + case "inf-20100630-2": + return i18n("wiki.version.game.search", "Alpha_v1.0.0"); + case "1.19_deep_dark_experimental_snapshot-1": + return "1.19-exp1"; + case "in-20100130": + return i18n("wiki.version.game.search", "Indev_0.31_20100130"); + case "b1.6-tb3": + return i18n("wiki.version.game.search", "Beta_1.6_Test_Build_3"); + } + + if (id.startsWith("1.0.0-rc2")) return "RC2"; + if (id.startsWith("2.0")) return i18n("wiki.version.game.search", "2.0"); + if (id.startsWith("b1.8-pre1")) return "Beta_1.8-pre1"; + if (id.startsWith("b1.1-")) return i18n("wiki.version.game.search", "Beta_1.1"); + if (id.startsWith("a1.1.0")) return "Alpha_v1.1.0"; + if (id.startsWith("a1.0.14")) return "Alpha_v1.0.14"; + if (id.startsWith("a1.0.13_01")) return "Alpha_v1.0.13_01"; + if (id.startsWith("in-20100214")) return i18n("wiki.version.game.search", "Indev_20100214"); + + if (id.contains("experimental-snapshot")) { + return id.replace("-experimental-snapshot", "-exp"); + } + + if (id.startsWith("inf-")) return id.replace("inf-", "Infdev_"); + if (id.startsWith("in-")) return id.replace("in-", "Indev_"); + if (id.startsWith("rd-")) return "pre-Classic_" + id; + if (id.startsWith("b")) return id.replace("b", "Beta_"); + if (id.startsWith("a")) return id.replace("a", "Alpha_v"); + if (id.startsWith("c")) return id.replace("c", "Classic_").replace("st", "SURVIVAL_TEST"); + + return id; + } } } diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 07259a821..22b0f3166 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -1460,8 +1460,8 @@ version.settings=Settings version.update=Update Modpack wiki.tooltip=Minecraft Wiki Page -wiki.version.game.release=https://minecraft.wiki/w/Java_Edition_%s -wiki.version.game.snapshot=https://minecraft.wiki/w/Java_Edition_%s +wiki.version.game=https://minecraft.wiki/w/Special:Search?search=%s +wiki.version.game.search=Java_Edition_%s wizard.prev=< Prev wizard.failed=Failed diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index ed15d6879..198f8b977 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -1460,8 +1460,8 @@ version.settings=Configuración version.update=Actualizar Modpack wiki.tooltip=Página de Minecraft Wiki -wiki.version.game.release=https://es.minecraft.wiki/w/Java_Edition_%s -wiki.version.game.snapshot=https://es.minecraft.wiki/w/Java_Edition_%s +wiki.version.game=https://es.minecraft.wiki/w/Special:Search?search=%s +wiki.version.game.search=Java_Edition_%s wizard.prev=< Previo wizard.failed=Falló diff --git a/HMCL/src/main/resources/assets/lang/I18N_ja.properties b/HMCL/src/main/resources/assets/lang/I18N_ja.properties index bc8c9e0af..2125e310b 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ja.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ja.properties @@ -963,6 +963,9 @@ version.manage.rename.fail=バージョンの名前を変更できませんで version.settings=設定 version.update=modpackを更新する +wiki.version.game=https://ja.minecraft.wiki/w/Special:Search?search=%s +wiki.version.game.search=Java_Edition_%s + wizard.prev=< 前へ wizard.failed=失敗 wizard.finish=終了 diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index 8d4e7c510..83dc1920c 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -1460,8 +1460,8 @@ version.settings=Настройки version.update=Обновить модпак wiki.tooltip=Страница Minecraft Wiki -wiki.version.game.release=https://ru.minecraft.wiki/w/%s_(Java_Edition) -wiki.version.game.snapshot=https://ru.minecraft.wiki/w/%s_(Java_Edition) +wiki.version.game=https://ru.minecraft.wiki/w/Special:Search?search=%s +wiki.version.game.search=%s_(Java_Edition) wizard.prev=< Пред. wizard.failed=Не удалось diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 6afe42e7f..d19bb2386 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -1253,8 +1253,8 @@ version.settings=遊戲設定 version.update=更新模組包 wiki.tooltip=Minecraft Wiki 頁面 -wiki.version.game.release=https://zh.minecraft.wiki/w/Java%%E7%%89%%88%s?variant=zh-tw -wiki.version.game.snapshot=https://zh.minecraft.wiki/w/%s?variant=zh-tw +wiki.version.game=https://zh.minecraft.wiki/w/Special:Search?search=%s&variant=zh-tw +wiki.version.game.search=Java版%s wizard.prev=< 上一步 wizard.failed=失敗 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 1b2b2f0d1..75893fb05 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -1263,8 +1263,8 @@ version.settings=游戏设置 version.update=更新整合包 wiki.tooltip=Minecraft Wiki 页面 -wiki.version.game.release=https://zh.minecraft.wiki/w/Java%%E7%%89%%88%s?variant=zh-cn -wiki.version.game.snapshot=https://zh.minecraft.wiki/w/%s?variant=zh-cn +wiki.version.game=https://zh.minecraft.wiki/w/Special:Search?search=%s&variant=zh-cn +wiki.version.game.search=Java版%s wizard.prev=< 上一步 wizard.failed=失败