mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add conditional check for plugin hotkey updates
Previously, `UpdatePluginHotkeyInfoTranslations` was called for all plugins, even those without hotkey support. This commit adds a conditional check to ensure the method is only invoked for plugins implementing the `IPluginHotkey` interface. Additionally, comments were added to clarify the purpose of the hotkey update logic. These changes improve robustness by preventing unnecessary or invalid calls for non-hotkey plugins.
This commit is contained in:
parent
f6759a50d3
commit
e3306ecfe8
1 changed files with 11 additions and 3 deletions
|
|
@ -360,7 +360,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
|
||||
public static void UpdatePluginMetadataTranslations()
|
||||
{
|
||||
// Update plugin metadata name & description & plugin hotkey name & description
|
||||
// Update plugin metadata name & description
|
||||
foreach (var p in PluginManager.GetTranslationPlugins())
|
||||
{
|
||||
if (p.Plugin is not IPluginI18n pluginI18N) return;
|
||||
|
|
@ -368,7 +368,11 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle();
|
||||
p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription();
|
||||
PluginManager.UpdatePluginHotkeyInfoTranslations(p);
|
||||
if (p.Plugin is IPluginHotkey)
|
||||
{
|
||||
// Update plugin hotkey name & description
|
||||
PluginManager.UpdatePluginHotkeyInfoTranslations(p);
|
||||
}
|
||||
pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -386,7 +390,11 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle();
|
||||
p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription();
|
||||
PluginManager.UpdatePluginHotkeyInfoTranslations(p);
|
||||
if (p.Plugin is IPluginHotkey)
|
||||
{
|
||||
// Update plugin hotkey name & description
|
||||
PluginManager.UpdatePluginHotkeyInfoTranslations(p);
|
||||
}
|
||||
pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue