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");