3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

Don't replace unchanged 1.12->1.13 translations with hard text

Also add the remaining unchanged keys to the file
Fixes #3284
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-05-28 13:48:22 +02:00
Ursprung 544a28b06b
Commit 5c0eda76e8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 93 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -94,37 +94,38 @@ public class MappingData extends MappingDataBase {
}
}
Map<String, String> translateData = GsonUtil.getGson().fromJson(
Map<String, String> translationMappingData = GsonUtil.getGson().fromJson(
new InputStreamReader(MappingData.class.getClassLoader().getResourceAsStream("assets/viaversion/data/mapping-lang-1.12-1.13.json")),
new TypeToken<Map<String, String>>() {
}.getType());
try {
String[] lines;
try (Reader reader = new InputStreamReader(MappingData.class.getClassLoader()
.getResourceAsStream("assets/viaversion/data/en_US.properties"), StandardCharsets.UTF_8)) {
lines = CharStreams.toString(reader).split("\n");
}
for (String line : lines) {
if (line.isEmpty()) {
continue;
}
String[] keyAndTranslation = line.split("=", 2);
if (keyAndTranslation.length != 2) {
continue;
}
String key = keyAndTranslation[0];
String translation = keyAndTranslation[1].replaceAll("%(\\d\\$)?d", "%$1s").trim();
mojangTranslation.put(key, translation);
String dataValue = translateData.get(key);
if (dataValue != null) {
translateMapping.put(key, dataValue);
}
}
String[] unmappedTranslationLines;
try (Reader reader = new InputStreamReader(MappingData.class.getClassLoader()
.getResourceAsStream("assets/viaversion/data/en_US.properties"), StandardCharsets.UTF_8)) {
unmappedTranslationLines = CharStreams.toString(reader).split("\n");
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
for (String line : unmappedTranslationLines) {
if (line.isEmpty()) {
continue;
}
String[] keyAndTranslation = line.split("=", 2);
if (keyAndTranslation.length != 2) {
continue;
}
String key = keyAndTranslation[0];
String translation = keyAndTranslation[1].replaceAll("%(\\d\\$)?d", "%$1s").trim();
mojangTranslation.put(key, translation);
// Null values in the file mean the key did not change AND the translation has the same amount of placeholders still
if (translationMappingData.containsKey(key)) {
String mappedKey = translationMappingData.get(key);
translateMapping.put(key, mappedKey != null ? mappedKey : key);
}
}
}

Datei anzeigen

@ -2752,5 +2752,70 @@
"advancements.story.smelt_iron.title": null,
"advancements.story.smelt_iron.description": null,
"advancements.story.upgrade_tools.title": null,
"advancements.story.upgrade_tools.description": null
"selectWorld.edit.openFolder": null,
"selectWorld.edit.save": null,
"selectWorld.versionWarning": null,
"selectWorld.versionJoinButton": null,
"selectWorld.allowCommands.info": null,
"multiplayer.downloadingTerrain": null,
"multiplayer.disconnect.banned": null,
"multiplayer.disconnect.ip_banned": null,
"multiplayer.disconnect.kicked": null,
"disconnect.loginFailed": null,
"disconnect.loginFailedInfo": null,
"options.narrator.off": null,
"key.mouse.left": null,
"key.mouse.middle": null,
"key.mouse.right": null,
"structure_block.size_failure": null,
"death.attack.hotFloor": null,
"commands.setidletimeout.success": null,
"commands.summon.failed": null,
"commands.setblock.failed": null,
"commands.fill.success": null,
"commands.fill.failed": null,
"commands.clone.success": null,
"commands.clone.failed": null,
"commands.time.query": null,
"commands.op.success": null,
"commands.deop.success": null,
"commands.banip.invalid": null,
"commands.save.enabled": null,
"commands.save.disabled": null,
"commands.save.success": null,
"commands.advancement.criterionNotFound": null,
"commands.reload.success": null,
"commands.scoreboard.objectives.add.success": null,
"commands.scoreboard.objectives.remove.success": null,
"commands.scoreboard.objectives.list.empty": null,
"commands.scoreboard.players.list.empty": null,
"commands.defaultgamemode.success": null,
"commands.difficulty.success": null,
"commands.setworldspawn.success": null,
"commands.worldborder.center.success": null,
"commands.locate.success": null,
"subtitles.entity.generic.small_fall": null,
"subtitles.entity.llama.angry": null,
"subtitles.item.armor.equip": null,
"subtitles.item.armor.equip_elytra": null,
"debug.reload_chunks.help": null,
"debug.show_hitboxes.help": null,
"debug.clear_chat.help": null,
"debug.cycle_renderdistance.help": null,
"debug.chunk_boundaries.help": null,
"debug.advanced_tooltips.help": null,
"debug.creative_spectator.help": null,
"debug.pause_focus.help": null,
"debug.help.help": null,
"debug.reload_resourcepacks.help": null,
"advancements.adventure.sleep_in_bed.title": null,
"advancements.adventure.sniper_duel.title": null,
"advancements.adventure.sniper_duel.description": null,
"advancements.end.elytra.description": null,
"advancements.end.respawn_dragon.description": null,
"advancements.nether.get_wither_skull.description": null,
"advancements.nether.fast_travel.description": null,
"advancements.nether.uneasy_alliance.description": null,
"advancements.story.cure_zombie_villager.description": null,
"advancements.story.follow_ender_eye.description": null
}