Merge pull request #2881 from Flow-Launcher/fix-startup-localization-issues

Fix startup localization issues
This commit is contained in:
Jeremy Wu 2024-08-11 21:09:49 +10:00 committed by GitHub
commit a075205e36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -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,8 @@ namespace Flow.Launcher.Core.Plugin
public static IEnumerable<PluginPair> GetPluginsForInterface<T>() where T : IFeatures
{
return AllPlugins.Where(p => p.Plugin is T);
// 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<PluginPair>();
}
public static List<Result> GetContextMenusForPlugin(Result result)

View file

@ -58,6 +58,9 @@ 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();
}