From 007dcc931f9397f3db5b518dc725257f5cd79855 Mon Sep 17 00:00:00 2001 From: Flamarine Date: Fri, 29 Sep 2023 00:43:02 +0800 Subject: [PATCH] im a dumbass * fix language issues without halplibe * remove unused * bump to 2.0.2 --- gradle.properties | 2 +- .../io/github/prospector/modmenu/mixin/MixinI18n.java | 11 ++++++++++- src/main/resources/lang/modmenu/en_US.lang | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index e3c67574..471d21f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Also makes builds more reliable and less likely to randomly fail. org.gradle.daemon=false -mod_version=2.0.1 +mod_version=2.0.2 mod_group=io.github.turniplabs mod_name=modmenu-bta diff --git a/src/main/java/io/github/prospector/modmenu/mixin/MixinI18n.java b/src/main/java/io/github/prospector/modmenu/mixin/MixinI18n.java index 72dcbbf2..e24d43af 100644 --- a/src/main/java/io/github/prospector/modmenu/mixin/MixinI18n.java +++ b/src/main/java/io/github/prospector/modmenu/mixin/MixinI18n.java @@ -29,7 +29,7 @@ public static InputStream getResourceAsStream(String path) { ) private void modmenu$addLangEntries(String languageCode, boolean save, CallbackInfo ci) { Properties entries = ((LanguageAccessor) currentLanguage).getEntries(); - String lang = "/lang/modmenu/" + currentLanguage.getId() + ".json"; + String lang = "/lang/modmenu/" + currentLanguage.getId() + ".lang"; try (InputStream stream = getResourceAsStream(lang)) { if (stream != null) { InputStreamReader r = new InputStreamReader(stream, StandardCharsets.UTF_8); @@ -38,5 +38,14 @@ public static InputStream getResourceAsStream(String path) { } catch (IOException e) { e.printStackTrace(); } + String defaultLang = "/lang/modmenu/en_US.lang"; + try (InputStream stream = getResourceAsStream(defaultLang)) { + if (stream != null) { + InputStreamReader r = new InputStreamReader(stream, StandardCharsets.UTF_8); + ((LanguageAccessor) (Object) Language.Default.INSTANCE).getEntries().load(r); + } + } catch (IOException e) { + e.printStackTrace(); + } } } diff --git a/src/main/resources/lang/modmenu/en_US.lang b/src/main/resources/lang/modmenu/en_US.lang index 9431fa47..2c34ca8d 100644 --- a/src/main/resources/lang/modmenu/en_US.lang +++ b/src/main/resources/lang/modmenu/en_US.lang @@ -25,5 +25,3 @@ modmenu.sorting.ascending=A-Z modmenu.sorting.decending=Z-A modmenu.minecraft=Minecraft modmenu.forge=Forge -modmenu.default.mc.desc.normal=The base game. -modmenu.default.mc.desc.based=The based game.