modify scripts

This commit is contained in:
2025-10-17 10:59:23 +08:00
parent 9336ed0d6f
commit 4f782a638e
131 changed files with 79880 additions and 3549 deletions

View File

@ -12,6 +12,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using TMPro;
using UnityEngine;
@ -64,14 +65,24 @@ namespace WordsToolkit.Scripts.Localization
SystemLanguage lang;
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.LinuxEditor)
{
lang = _debugSettings.TestLanguage;
// Use TestLanguageCode from DebugSettings and convert to SystemLanguage
try
{
var cultureInfo = new CultureInfo(_debugSettings.TestLanguageCode);
lang = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), cultureInfo.EnglishName);
}
catch (Exception)
{
Debug.LogWarning($"Failed to parse TestLanguageCode '{_debugSettings.TestLanguageCode}'. Using English as fallback.");
lang = SystemLanguage.English;
}
}
else
{
lang = Application.systemLanguage;
}
return this.Any(i => i.language == lang) ? _debugSettings.TestLanguage : SystemLanguage.English;
return this.Any(i => i.language == lang) ? lang : SystemLanguage.English;
}
public IEnumerable<LanguageObject> GetText(DebugSettings _debugSettings)