From 474a557e0109a11f1bed01bb0161823535ca84ed Mon Sep 17 00:00:00 2001
From: Isaac Marovitz <isaacryu@icloud.com>
Date: Fri, 9 Feb 2024 12:40:29 -0500
Subject: [PATCH] Fix Preview Plugins

---
 src/Ryujinx.Ava/App.axaml.cs                   |  4 ++++
 src/Ryujinx.Ava/Common/Locale/LocaleManager.cs | 16 ++++++----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/Ryujinx.Ava/App.axaml.cs b/src/Ryujinx.Ava/App.axaml.cs
index 387a6dc14..f27038aed 100644
--- a/src/Ryujinx.Ava/App.axaml.cs
+++ b/src/Ryujinx.Ava/App.axaml.cs
@@ -46,6 +46,10 @@ namespace Ryujinx.Ava
                 ConfigurationState.Instance.UI.CustomThemePath.Event += ThemeChanged_Event;
                 ConfigurationState.Instance.UI.EnableCustomTheme.Event += CustomThemeChanged_Event;
             }
+            else
+            {
+                ConfigurationState.Initialize();
+            }
         }
 
         private void CustomThemeChanged_Event(object sender, ReactiveEventArgs<bool> e)
diff --git a/src/Ryujinx.Ava/Common/Locale/LocaleManager.cs b/src/Ryujinx.Ava/Common/Locale/LocaleManager.cs
index b2f3e7ab9..4f48aaa59 100644
--- a/src/Ryujinx.Ava/Common/Locale/LocaleManager.cs
+++ b/src/Ryujinx.Ava/Common/Locale/LocaleManager.cs
@@ -35,17 +35,13 @@ namespace Ryujinx.Ava.Common.Locale
             // Load the system Language Code.
             string localeLanguageCode = CultureInfo.CurrentCulture.Name.Replace('-', '_');
 
-            // If the view is loaded with the UI Previewer detached, then override it with the saved one or default.
-            if (Program.PreviewerDetached)
+            if (!string.IsNullOrEmpty(ConfigurationState.Instance.Ui.LanguageCode.Value))
             {
-                if (!string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value))
-                {
-                    localeLanguageCode = ConfigurationState.Instance.UI.LanguageCode.Value;
-                }
-                else
-                {
-                    localeLanguageCode = DefaultLanguageCode;
-                }
+                localeLanguageCode = ConfigurationState.Instance.Ui.LanguageCode.Value;
+            }
+            else
+            {
+                localeLanguageCode = DefaultLanguageCode;
             }
 
             // Load en_US as default, if the target language translation is incomplete.