Skip to content

Commit a075205

Browse files
authored
Merge pull request #2881 from Flow-Launcher/fix-startup-localization-issues
Fix startup localization issues
2 parents dd0ae98 + 89e430f commit a075205

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Core.ExternalPlugins;
1+
using Flow.Launcher.Core.ExternalPlugins;
22
using System;
33
using System.Collections.Concurrent;
44
using System.Collections.Generic;
@@ -308,7 +308,8 @@ public static PluginPair GetPluginForId(string id)
308308

309309
public static IEnumerable<PluginPair> GetPluginsForInterface<T>() where T : IFeatures
310310
{
311-
return AllPlugins.Where(p => p.Plugin is T);
311+
// Handle scenario where this is called before all plugins are instantiated, e.g. language change on startup
312+
return AllPlugins?.Where(p => p.Plugin is T) ?? Array.Empty<PluginPair>();
312313
}
313314

314315
public static List<Result> GetContextMenusForPlugin(Result result)

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ internal void AddPluginLanguageDirectories(IEnumerable<PluginPair> plugins)
5858

5959
private void LoadDefaultLanguage()
6060
{
61+
// Removes language files loaded before any plugins were loaded.
62+
// Prevents the language Flow started in from overwriting English if the user switches back to English
63+
RemoveOldLanguageFiles();
6164
LoadLanguage(AvailableLanguages.English);
6265
_oldResources.Clear();
6366
}

0 commit comments

Comments
 (0)