From 8c3e21c34a0e2df661462f9b0b2e7be771042f6a Mon Sep 17 00:00:00 2001 From: Wilhelm Schuster Date: Sun, 24 Nov 2024 10:24:49 +0100 Subject: [PATCH] Add fallback string for close window dialog (#1087) Co-authored-by: Martin Robertz --- .../mixin/mixins/early/MixinMinecraft_ConfirmExit.java | 9 +++++++-- src/main/resources/assets/dreamcraft/lang/en_US.lang | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java b/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java index 52ce8eeb8..b979e0f61 100644 --- a/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java +++ b/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java @@ -7,7 +7,7 @@ import javax.swing.JOptionPane; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; +import net.minecraft.util.StatCollector; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; @@ -48,7 +48,12 @@ public class MixinMinecraft_ConfirmExit { final ImageIcon imageIcon = resource == null ? null : new ImageIcon(resource); final int result = JOptionPane.showConfirmDialog( frame, - I18n.format("dreamcraft.gui.quitmessage"), + // When FML encounters an error, the only way to close the window is through the close button, + // which will show this message, unfortunately at this point, no localisations will have been + // loaded, so we add a hardcoded fallback message here. + StatCollector.canTranslate("dreamcraft.gui.quitmessage") + ? StatCollector.translateToLocal("dreamcraft.gui.quitmessage") + : "Are you sure you want to exit the game?", Refstrings.NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, diff --git a/src/main/resources/assets/dreamcraft/lang/en_US.lang b/src/main/resources/assets/dreamcraft/lang/en_US.lang index a66c5719d..21a84ee11 100644 --- a/src/main/resources/assets/dreamcraft/lang/en_US.lang +++ b/src/main/resources/assets/dreamcraft/lang/en_US.lang @@ -1739,7 +1739,7 @@ item.tconstruct.manual.weaponry.part_materials=\n\nValid Shaft Materials:\n* Sti item.tconstruct.manual.weaponry.bolts=\n\nBolts:\nCrafting bolts is a delicate process. First you need a core in the form of a tool rod.\nTake this tool rod to a smeltery and put it into a Casting Table. Pour some metal onto it to coat the tip with a more damaging material.\nAfter this process, add a fletching and your bolts are ready to be used.\n\nSince the bolts consist of a harder core and tip they carry more weight than regular arrows, making them perfect to fight armored targets. dreamcraft.mobsinfocompat.limitedropcount=Drops only %s times per person -dreamcraft.gui.quitmessage=Are you sure you want to exit the game ? +dreamcraft.gui.quitmessage=Are you sure you want to exit the game? dreamcraft.welcome.welcome=Welcome to Gregtech: New Horizons dreamcraft.welcome.questbook=The Quest Book has a shortcut key, check your keybindings. @@ -1751,4 +1751,4 @@ dreamcraft.welcome.visitdiscord=Visit our discord at dreamcraft.welcome.click_discord=Click to open discord! dreamcraft.pausemenu.bug=Report a Bug -dreamcraft.pausemenu.wiki=Open the Wiki \ No newline at end of file +dreamcraft.pausemenu.wiki=Open the Wiki