Automatic language detection

This commit is contained in:
SGKoishi 2025-01-26 15:11:15 +09:00
parent c6dfb97349
commit c4a141308e
No known key found for this signature in database
GPG key ID: 8FFC399070653828

View file

@ -60,6 +60,12 @@ namespace TShockAPI
}
}
if (LanguageManager.Instance.ActiveCulture == GameCulture.DefaultCulture)
{
var bf = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static;
// LanguageManager.SetLanguage will change this so we need to reset it back to null
typeof(CultureInfo).GetField("s_currentThreadUICulture", bf)?.SetValue(null, null);
}
return CultureInfo.CurrentUICulture;
}
}