Add Auto Localization Initialization

This commit is contained in:
copecone committed 2026-10-05 14:30:01 +09:00
1 parent 92a4654f14
commit 6c0347609d
2 files changed
+8 -2

No files matched your search

+7 -2
View File
@@ -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();
}
/// <summary>
/// Initializes the localization system and loads embedded language dictionaries.
/// </summary>
@@ -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))
+1
View File
@@ -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");