From 81e5eaf10d66370d6a672a8cd0860f64f0380655 Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Sat, 10 Aug 2024 09:23:47 +0600 Subject: [PATCH 1/4] Fix startup localization issues --- Flow.Launcher.Core/Plugin/PluginManager.cs | 4 ++-- Flow.Launcher.Core/Resource/Internationalization.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index f5fa5e518..2223ceca6 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Core.ExternalPlugins; +using Flow.Launcher.Core.ExternalPlugins; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -308,7 +308,7 @@ namespace Flow.Launcher.Core.Plugin public static IEnumerable GetPluginsForInterface() where T : IFeatures { - return AllPlugins.Where(p => p.Plugin is T); + return AllPlugins?.Where(p => p.Plugin is T) ?? Array.Empty(); } public static List GetContextMenusForPlugin(Result result) diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 192ed2e81..0a68805a7 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -58,6 +58,7 @@ namespace Flow.Launcher.Core.Resource private void LoadDefaultLanguage() { + RemoveOldLanguageFiles(); LoadLanguage(AvailableLanguages.English); _oldResources.Clear(); } From 7e3690f007e9240b9adc27b3e762a07a4d6d4ff5 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 11 Aug 2024 20:54:10 +1000 Subject: [PATCH 2/4] add comment --- Flow.Launcher.Core/Resource/Internationalization.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 0a68805a7..f6f35589d 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -58,6 +58,8 @@ namespace Flow.Launcher.Core.Resource private void LoadDefaultLanguage() { + // Removes language files loaded before any plugins were loaded. + // Prevents the language Flow started in from overwriting English if the user switches back to English RemoveOldLanguageFiles(); LoadLanguage(AvailableLanguages.English); _oldResources.Clear(); From 89e430f41f2cc1f785446de60f7e32f95b3e75ec Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 11 Aug 2024 20:56:03 +1000 Subject: [PATCH 3/4] add comment --- Flow.Launcher.Core/Plugin/PluginManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 2223ceca6..91cb36a0e 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -308,6 +308,7 @@ namespace Flow.Launcher.Core.Plugin public static IEnumerable GetPluginsForInterface() where T : IFeatures { + // Handle scenario where this is called before all plugins are instantiated, e.g. language change on startup return AllPlugins?.Where(p => p.Plugin is T) ?? Array.Empty(); } From f321b3635f6b71316cd426a3a7ff717c0a558d18 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 11 Aug 2024 21:10:01 +1000 Subject: [PATCH 4/4] add sponsor to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c563eafc9..0f1e084bd 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,7 @@ Or download the [early access version](https://github.com/Flow-Launcher/Prerelea +