Add C# current culture sync with localization system

This commit is contained in:
Wojtek Figat
2021-04-27 10:22:29 +02:00
parent bdde0af771
commit 06be726a6f

View File

@@ -158,13 +158,22 @@ namespace FlaxEngine
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException; TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
Localization.LocalizationChanged += OnLocalizationChanged;
OnLocalizationChanged();
if (!Engine.IsEditor) if (!Engine.IsEditor)
{ {
CreateGuiStyle(); CreateGuiStyle();
} }
} }
private static void OnLocalizationChanged()
{
var currentThread = Thread.CurrentThread;
currentThread.CurrentUICulture = Localization.CurrentLanguage;
currentThread.CurrentCulture = Localization.CurrentCulture;
}
/// <summary> /// <summary>
/// Sets the managed window as a main game window. Called after creating game window by the native code. /// Sets the managed window as a main game window. Called after creating game window by the native code.
/// </summary> /// </summary>