From e3306ecfe8506658c80d41cdc0b581bca55ce497 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 16 Oct 2025 20:36:55 +0800 Subject: [PATCH] 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. --- .../Resource/Internationalization.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index acb9cdde3..3c9651bb2 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -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)