修复版本 Wiki 映射 (#4211)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
This commit is contained in:
ENC_Euphony 2025-08-10 15:06:31 +08:00 committed by GitHub
parent 8f3c716ca7
commit be9efbe6ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 62 additions and 13 deletions

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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ó

View File

@ -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=終了

View File

@ -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=Не удалось

View File

@ -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=失敗

View File

@ -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=失败