From 6c0347609d0d9cad0a846f98358f10720b15285923fded20bcba6bb844751089 Mon Sep 17 00:00:00 2001 From: copecone Date: Mon, 5 Oct 2026 14:30:01 +0900 Subject: [PATCH] Add Auto Localization Initialization --- Localization/LocalizationManager.cs | 9 +++++++-- RenderMod.cs | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Localization/LocalizationManager.cs b/Localization/LocalizationManager.cs index 40658cb..15bb674 100644 --- a/Localization/LocalizationManager.cs +++ b/Localization/LocalizationManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using MelonLoader; using Newtonsoft.Json; using UnityEngine; @@ -33,6 +32,11 @@ internal static class LocalizationManager private static bool _initialized; + static LocalizationManager() + { + Initialize(); + } + /// /// Initializes the localization system and loads embedded language dictionaries. /// @@ -115,7 +119,7 @@ internal static class LocalizationManager localeCode = FallbackLocaleCode; } - var isChanged = (language != CurrentLanguage) || (localeCode != CurrentLocaleCode); + var isChanged = language != CurrentLanguage || localeCode != CurrentLocaleCode; CurrentLanguage = language; CurrentLocaleCode = localeCode; @@ -140,6 +144,7 @@ internal static class LocalizationManager public static string Get(string key) { if (string.IsNullOrEmpty(key)) return string.Empty; + if (!_initialized) Initialize(); // 1. Try currently active locale if (Locales.TryGetValue(CurrentLocaleCode, out var activeDict) && activeDict.TryGetValue(key, out var val)) diff --git a/RenderMod.cs b/RenderMod.cs index 002bf3b..bbfc5ce 100644 --- a/RenderMod.cs +++ b/RenderMod.cs @@ -27,6 +27,7 @@ internal class RenderMod : MelonMod public override void OnInitializeMelon() { GlobalSettings.Load(); + Localization.LocalizationManager.Initialize(); ffmpeg.RootPath = MelonEnvironment.UserLibsDirectory; var renderManagerObj = new GameObject("Render Manager");