From b9418f12721f991ffae6d8bc1cdd24f8fc9087c4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 11:33:12 +0800 Subject: [PATCH 01/10] Add translations --- Plugins/Flow.Launcher.Plugin.Calculator/Languages/en.xaml | 8 +++++--- Plugins/Flow.Launcher.Plugin.Calculator/Main.cs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Calculator/Languages/en.xaml index 0e0911a70ec..e646bab0e4d 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Languages/en.xaml @@ -1,6 +1,7 @@ - + Calculator Allows to do mathematical calculations.(Try 5*3-2 in Flow Launcher) @@ -13,4 +14,5 @@ Comma (,) Dot (.) Max. decimal places + Copy failed, please try later \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs index eb3c808e767..3d06c4ce0b5 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs @@ -100,7 +100,7 @@ public List Query(Query query) } catch (ExternalException) { - Context.API.ShowMsgBox("Copy failed, please try later"); + Context.API.ShowMsgBox(Context.API.GetTranslation("flowlauncher_plugin_calculator_failed_to_copy")); return false; } } From 0682e9bed15d37899dff37e291e93a7957a2876a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 11:38:44 +0800 Subject: [PATCH 02/10] Improve code quality for public api --- Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs | 6 +++++- Flow.Launcher.Core/Plugin/PluginsLoader.cs | 2 +- Flow.Launcher.Core/Resource/Internationalization.cs | 2 +- Flow.Launcher.Infrastructure/Http/Http.cs | 6 +++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs index 7ca91eaecde..e58b299f641 100644 --- a/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs +++ b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs @@ -22,6 +22,10 @@ public static class PluginsManifest private static DateTime lastFetchedAt = DateTime.MinValue; private static readonly TimeSpan fetchTimeout = TimeSpan.FromMinutes(2); + // We should not initialize API in static constructor because it will create another API instance + private static IPublicAPI api = null; + private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService(); + public static List UserPlugins { get; private set; } public static async Task UpdateManifestAsync(bool usePrimaryUrlOnly = false, CancellationToken token = default) @@ -46,7 +50,7 @@ public static async Task UpdateManifestAsync(bool usePrimaryUrlOnly = fals } catch (Exception e) { - Ioc.Default.GetRequiredService().LogException(ClassName, "Http request failed", e); + API.LogException(ClassName, "Http request failed", e); } finally { diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index 256c36065a9..a17d55f0287 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -126,7 +126,7 @@ private static IEnumerable DotNetPlugins(List source _ = Task.Run(() => { - Ioc.Default.GetRequiredService().ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" + + API.ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" + $"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" + $"Please refer to the logs for more information", "", MessageBoxButton.OK, MessageBoxImage.Warning); diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 7b7d6eef661..256975654d5 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -214,7 +214,7 @@ public bool PromptShouldUsePinyin(string languageCodeToSet) // "Do you want to search with pinyin?" string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ; - if (Ioc.Default.GetRequiredService().ShowMsgBox(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) + if (API.ShowMsgBox(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) return false; return true; diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index 22eb065f534..44b70baae7a 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -20,6 +20,10 @@ public static class Http private static readonly HttpClient client = new(); + // We should not initialize API in static constructor because it will create another API instance + private static IPublicAPI api = null; + private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService(); + static Http() { // need to be added so it would work on a win10 machine @@ -78,7 +82,7 @@ var userName when string.IsNullOrEmpty(userName) => } catch (UriFormatException e) { - Ioc.Default.GetRequiredService().ShowMsg("Please try again", "Unable to parse Http Proxy"); + API.ShowMsg("Please try again", "Unable to parse Http Proxy"); Log.Exception(ClassName, "Unable to parse Uri", e); } } From 85ffd6024bf1ac244919bac56065f285d06f1929 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:07:15 +0800 Subject: [PATCH 03/10] Add translations --- .../Flow.Launcher.Plugin.Explorer/ContextMenu.cs | 16 +++++++--------- .../Languages/en.xaml | 3 +++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index c331c498568..dfaefe03a5c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -221,9 +221,8 @@ public List LoadContextMenus(Result selectedResult) } catch (Exception e) { - var message = $"Fail to delete {record.FullPath}"; - LogException(message, e); - Context.API.ShowMsgError(message); + LogException($"Fail to delete {record.FullPath}", e); + Context.API.ShowMsgError(string.Format(Context.API.GetTranslation("plugin_explorer_fail_to_delete"), record.FullPath)); return false; } @@ -265,9 +264,9 @@ public List LoadContextMenus(Result selectedResult) } catch (FileNotFoundException e) { - var name = "Plugin: Folder"; - var message = $"File not found: {e.Message}"; - Context.API.ShowMsgError(name, message); + Context.API.ShowMsgError( + Context.API.GetTranslation("plugin_explorer_plugin_name"), + string.Format(Context.API.GetTranslation("plugin_explorer_file_not_found"), e.Message)); return false; } @@ -334,9 +333,8 @@ private Result CreateOpenContainingFolderResult(SearchResult record) } catch (Exception e) { - var message = $"Fail to open file at {record.FullPath}"; - LogException(message, e); - Context.API.ShowMsgError(message); + LogException($"Fail to open file at {record.FullPath}", e); + Context.API.ShowMsgError(string.Format(Context.API.GetTranslation("plugin_explorer_fail_to_open"), record.FullPath)); return false; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 40aeda957fe..e3c76d626b9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -132,6 +132,9 @@ Show Windows Context Menu Open With Select a program to open with + Fail to delete {0} + File not found: {0} + Fail to open {0} {0} free of {1} From 06b3219dcb6d7f0ae1c70200b15006e11bb39d7c Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:07:19 +0800 Subject: [PATCH 04/10] Add translations --- Flow.Launcher.Core/Configuration/Portable.cs | 19 +++++++------------ Flow.Launcher.Core/Plugin/PluginsLoader.cs | 8 ++++---- Flow.Launcher/Languages/en.xaml | 12 ++++++++++++ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Flow.Launcher.Core/Configuration/Portable.cs b/Flow.Launcher.Core/Configuration/Portable.cs index 7f02cef0990..721e14dcaac 100644 --- a/Flow.Launcher.Core/Configuration/Portable.cs +++ b/Flow.Launcher.Core/Configuration/Portable.cs @@ -45,8 +45,7 @@ public void DisablePortableMode() #endif IndicateDeletion(DataLocation.PortableDataPath); - API.ShowMsgBox("Flow Launcher needs to restart to finish disabling portable mode, " + - "after the restart your portable data profile will be deleted and roaming data profile kept"); + API.ShowMsgBox(API.GetTranslation("restartToDisablePortableMode")); UpdateManager.RestartApp(Constant.ApplicationFileName); } @@ -69,8 +68,7 @@ public void EnablePortableMode() #endif IndicateDeletion(DataLocation.RoamingDataPath); - API.ShowMsgBox("Flow Launcher needs to restart to finish enabling portable mode, " + - "after the restart your roaming data profile will be deleted and portable data profile kept"); + API.ShowMsgBox(API.GetTranslation("restartToEnablePortableMode")); UpdateManager.RestartApp(Constant.ApplicationFileName); } @@ -154,9 +152,8 @@ public void PreStartCleanUpAfterPortabilityUpdate() { FilesFolders.RemoveFolderIfExists(roamingDataDir, (s) => API.ShowMsgBox(s)); - if (API.ShowMsgBox("Flow Launcher has detected you enabled portable mode, " + - "would you like to move it to a different location?", string.Empty, - MessageBoxButton.YesNo) == MessageBoxResult.Yes) + if (API.ShowMsgBox(API.GetTranslation("moveToDifferentLocation"), + string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { FilesFolders.OpenPath(Constant.RootDirectory, (s) => API.ShowMsgBox(s)); @@ -169,8 +166,7 @@ public void PreStartCleanUpAfterPortabilityUpdate() { FilesFolders.RemoveFolderIfExists(portableDataDir, (s) => API.ShowMsgBox(s)); - API.ShowMsgBox("Flow Launcher has detected you disabled portable mode, " + - "the relevant shortcuts and uninstaller entry have been created"); + API.ShowMsgBox(API.GetTranslation("shortcutsUninstallerCreated")); } } @@ -181,9 +177,8 @@ public bool CanUpdatePortability() if (roamingLocationExists && portableLocationExists) { - API.ShowMsgBox(string.Format("Flow Launcher detected your user data exists both in {0} and " + - "{1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.", - DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine)); + API.ShowMsgBox(string.Format(API.GetTranslation("userDataDuplicated"), + DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine)); return false; } diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index a17d55f0287..9d511297e3e 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -120,15 +120,15 @@ private static IEnumerable DotNetPlugins(List source { var errorPluginString = string.Join(Environment.NewLine, erroredPlugins); - var errorMessage = "The following " - + (erroredPlugins.Count > 1 ? "plugins have " : "plugin has ") - + "errored and cannot be loaded:"; + var errorMessage = erroredPlugins.Count > 1 ? + API.GetTranslation("pluginsHaveErrored") : + API.GetTranslation("pluginHasErrored"); _ = Task.Run(() => { API.ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" + $"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" + - $"Please refer to the logs for more information", "", + API.GetTranslation("referToLogs"), string.Empty, MessageBoxButton.OK, MessageBoxImage.Warning); }); } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index ac58fdc5f7f..ed7dd9496a2 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -18,6 +18,18 @@ Fail to Init Plugins Plugins: {0} - fail to load and would be disabled, please contact plugin creator for help + + Flow Launcher needs to restart to finish disabling portable mode, after the restart your portable data profile will be deleted and roaming data profile kept + Flow Launcher needs to restart to finish enabling portable mode, after the restart your roaming data profile will be deleted and portable data profile kept + Flow Launcher has detected you enabled portable mode, would you like to move it to a different location? + Flow Launcher has detected you disabled portable mode, the relevant shortcuts and uninstaller entry have been created + Flow Launcher detected your user data exists both in {0} and {1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred. + + + The following plugin has errored and cannot be loaded: + The following plugins have errored and cannot be loaded: + Please refer to the logs for more information + Failed to register hotkey "{0}". The hotkey may be in use by another program. Change to a different hotkey, or exit another program. Failed to unregister hotkey "{0}". Please try again or see log for details From aed134f5897f99a24c7b3ae9d47c1b99d0eee8c9 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:15:48 +0800 Subject: [PATCH 05/10] Add translations --- Flow.Launcher.Infrastructure/Http/Http.cs | 2 +- Flow.Launcher/Languages/en.xaml | 6 ++++++ .../SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index 44b70baae7a..ec0456fef6a 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -82,7 +82,7 @@ var userName when string.IsNullOrEmpty(userName) => } catch (UriFormatException e) { - API.ShowMsg("Please try again", "Unable to parse Http Proxy"); + API.ShowMsg(API.GetTranslation("pleaseTryAgain"), API.GetTranslation("parseProxyFailed")); Log.Exception(ClassName, "Unable to parse Uri", e); } } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index ed7dd9496a2..b105f2658c5 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -30,6 +30,10 @@ The following plugins have errored and cannot be loaded: Please refer to the logs for more information + + Please try again + Unable to parse Http Proxy + Failed to register hotkey "{0}". The hotkey may be in use by another program. Change to a different hotkey, or exit another program. Failed to unregister hotkey "{0}". Please try again or see log for details @@ -152,6 +156,8 @@ Open Use Previous Korean IME You can change the Previous Korean IME settings directly from here + Failed to change Korean IME setting + Please check your system registry access or contact support. Home Page Show home page results when query text is empty. Show History Results in Home Page diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index e5b70cd87a3..1038abc0b11 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -216,8 +216,8 @@ public bool LegacyKoreanIMEEnabled } else { - //Since this is rarely seen text, language support is not provided. - App.API.ShowMsg("Failed to change Korean IME setting", "Please check your system registry access or contact support."); + // Since this is rarely seen text, language support is not provided. + App.API.ShowMsg(App.API.GetTranslation("KoreanImeSettingChangeFailTitle"), App.API.GetTranslation("KoreanImeSettingChangeFailSubTitle")); } } } From ba0a113cc9d4104a89cce11285d04bb2f9fc2922 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:28:55 +0800 Subject: [PATCH 06/10] Add translations & Use ShowMsgError --- Flow.Launcher.Core/Plugin/PluginManager.cs | 4 ++-- Flow.Launcher.Core/Updater.cs | 2 +- Flow.Launcher.Infrastructure/Http/Http.cs | 2 +- Flow.Launcher/App.xaml.cs | 2 +- .../Resources/Pages/WelcomePage5.xaml.cs | 2 +- .../ViewModels/SettingsPaneGeneralViewModel.cs | 6 +++--- .../Languages/en.xaml | 3 +++ .../Flow.Launcher.Plugin.BrowserBookmark/Main.cs | 7 ++----- .../Flow.Launcher.Plugin.Explorer/ContextMenu.cs | 15 ++++++--------- .../Languages/en.xaml | 2 ++ Plugins/Flow.Launcher.Plugin.Program/Main.cs | 2 +- .../Programs/UWPPackage.cs | 2 +- .../Flow.Launcher.Plugin.Shell/Languages/en.xaml | 9 ++++++--- Plugins/Flow.Launcher.Plugin.Shell/Main.cs | 14 ++++++++------ Plugins/Flow.Launcher.Plugin.Url/Main.cs | 2 +- 15 files changed, 39 insertions(+), 35 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index d88f2f050e5..9c54ad7b118 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -719,7 +719,7 @@ internal static async Task UninstallPluginAsync(PluginMetadata plugin, boo catch (Exception e) { API.LogException(ClassName, $"Failed to delete plugin settings folder for {plugin.Name}", e); - API.ShowMsg(API.GetTranslation("failedToRemovePluginSettingsTitle"), + API.ShowMsgError(API.GetTranslation("failedToRemovePluginSettingsTitle"), string.Format(API.GetTranslation("failedToRemovePluginSettingsMessage"), plugin.Name)); } } @@ -735,7 +735,7 @@ internal static async Task UninstallPluginAsync(PluginMetadata plugin, boo catch (Exception e) { API.LogException(ClassName, $"Failed to delete plugin cache folder for {plugin.Name}", e); - API.ShowMsg(API.GetTranslation("failedToRemovePluginCacheTitle"), + API.ShowMsgError(API.GetTranslation("failedToRemovePluginCacheTitle"), string.Format(API.GetTranslation("failedToRemovePluginCacheMessage"), plugin.Name)); } Settings.RemovePluginSettings(plugin.ID); diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 5b67ffabcc8..45275696c1d 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -111,7 +111,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true) } if (!silentUpdate) - _api.ShowMsg(_api.GetTranslation("update_flowlauncher_fail"), + _api.ShowMsgError(_api.GetTranslation("update_flowlauncher_fail"), _api.GetTranslation("update_flowlauncher_check_connection")); } finally diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index ec0456fef6a..8afab419bbc 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -82,7 +82,7 @@ var userName when string.IsNullOrEmpty(userName) => } catch (UriFormatException e) { - API.ShowMsg(API.GetTranslation("pleaseTryAgain"), API.GetTranslation("parseProxyFailed")); + API.ShowMsgError(API.GetTranslation("pleaseTryAgain"), API.GetTranslation("parseProxyFailed")); Log.Exception(ClassName, "Unable to parse Uri", e); } } diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 1bef1166eb2..93fd88e4f0b 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -267,7 +267,7 @@ private static void AutoStartup() // but if it fails (permissions, etc) then don't keep retrying // this also gives the user a visual indication in the Settings widget _settings.StartFlowLauncherOnSystemStartup = false; - API.ShowMsg(API.GetTranslation("setAutoStartFailed"), e.Message); + API.ShowMsgError(API.GetTranslation("setAutoStartFailed"), e.Message); } } } diff --git a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs index 8db0a9f7e08..10cd18821e1 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs @@ -59,7 +59,7 @@ private void ChangeAutoStartup(bool value) } catch (Exception e) { - App.API.ShowMsg(App.API.GetTranslation("setAutoStartFailed"), e.Message); + App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message); } } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 1038abc0b11..7cd4290587d 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -64,7 +64,7 @@ public bool StartFlowLauncherOnSystemStartup } catch (Exception e) { - App.API.ShowMsg(App.API.GetTranslation("setAutoStartFailed"), e.Message); + App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message); } } } @@ -91,7 +91,7 @@ public bool UseLogonTaskForStartup } catch (Exception e) { - App.API.ShowMsg(App.API.GetTranslation("setAutoStartFailed"), e.Message); + App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message); } } } @@ -217,7 +217,7 @@ public bool LegacyKoreanIMEEnabled else { // Since this is rarely seen text, language support is not provided. - App.API.ShowMsg(App.API.GetTranslation("KoreanImeSettingChangeFailTitle"), App.API.GetTranslation("KoreanImeSettingChangeFailSubTitle")); + App.API.ShowMsgError(App.API.GetTranslation("KoreanImeSettingChangeFailTitle"), App.API.GetTranslation("KoreanImeSettingChangeFailSubTitle")); } } } diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml index 22830e7c880..8f98213a490 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml @@ -7,6 +7,9 @@ Browser Bookmarks Search your browser bookmarks + + Failed to set url in clipboard + " Bookmark Data Open bookmarks in: diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs index 91ade206b67..b1600862e56 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs @@ -223,11 +223,8 @@ public List LoadContextMenus(Result selectedResult) } catch (Exception e) { - var message = "Failed to set url in clipboard"; - _context.API.LogException(ClassName, message, e); - - _context.API.ShowMsg(message); - + _context.API.LogException(ClassName, "Failed to set url in clipboard", e); + _context.API.ShowMsgError(_context.API.GetTranslation("flowlauncher_plugin_browserbookmark_copy_failed")); return false; } }, diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index dfaefe03a5c..c18abb3a23e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -132,9 +132,8 @@ public List LoadContextMenus(Result selectedResult) } catch (Exception e) { - var message = "Fail to set text in clipboard"; - LogException(message, e); - Context.API.ShowMsg(message); + LogException("Fail to set text in clipboard", e); + Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_text")); return false; } }, @@ -155,9 +154,8 @@ public List LoadContextMenus(Result selectedResult) } catch (Exception e) { - var message = "Fail to set text in clipboard"; - LogException(message, e); - Context.API.ShowMsg(message); + LogException("Fail to set text in clipboard", e); + Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_text")); return false; } }, @@ -178,9 +176,8 @@ public List LoadContextMenus(Result selectedResult) } catch (Exception e) { - var message = $"Fail to set file/folder in clipboard"; - LogException(message, e); - Context.API.ShowMsg(message); + LogException($"Fail to set file/folder in clipboard", e); + Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_files")); return false; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index e3c76d626b9..a2e26a0f066 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -135,6 +135,8 @@ Fail to delete {0} File not found: {0} Fail to open {0} + Fail to set text in clipboard + Fail to set files/folders in clipboard {0} free of {1} diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index fd687bfaeda..3a527090509 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -446,7 +446,7 @@ public static void StartProcess(Func runProcess, Proc var title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error"); var message = string.Format(Context.API.GetTranslation("flowlauncher_plugin_program_run_failed"), info.FileName); - Context.API.ShowMsg(title, string.Format(message, info.FileName), string.Empty); + Context.API.ShowMsgError(title, string.Format(message, info.FileName)); } } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs index 28f774333bc..9a8326e9aa6 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs @@ -462,7 +462,7 @@ public Result Result(string query, IPublicAPI api) var message = api.GetTranslation( "flowlauncher_plugin_program_run_as_administrator_not_supported_message"); - api.ShowMsg(title, message, string.Empty); + api.ShowMsgError(title, message); } return true; diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml index 645a0e14fd7..f27361c507d 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml @@ -1,6 +1,7 @@ - + Replace Win+R Close Command Prompt after pressing any key @@ -16,4 +17,6 @@ Run As Administrator Copy the command Only show number of most used commands: + Command not found: {0} + Error running the command: {0}" diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index a51aadec7df..8880099763b 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -335,15 +335,17 @@ private void Execute(Func startProcess, ProcessStartI } catch (FileNotFoundException e) { - var name = "Plugin: Shell"; - var message = $"Command not found: {e.Message}"; - Context.API.ShowMsg(name, message); + Context.API.ShowMsgError(GetTranslatedPluginTitle(), + string.Format(Context.API.GetTranslation("flowlauncher_plugin_cmd_command_not_found"), e.Message)); } catch (Win32Exception e) { - var name = "Plugin: Shell"; - var message = $"Error running the command: {e.Message}"; - Context.API.ShowMsg(name, message); + Context.API.ShowMsgError(GetTranslatedPluginTitle(), + string.Format(Context.API.GetTranslation("flowlauncher_plugin_cmd_error_running_command"), e.Message)); + } + catch (Exception e) + { + Context.API.LogException(ClassName, $"Error executing command: {info.FileName} {string.Join(" ", info.ArgumentList)}", e); } } diff --git a/Plugins/Flow.Launcher.Plugin.Url/Main.cs b/Plugins/Flow.Launcher.Plugin.Url/Main.cs index 03516636d43..9fa52c8da54 100644 --- a/Plugins/Flow.Launcher.Plugin.Url/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Url/Main.cs @@ -70,7 +70,7 @@ public List Query(Query query) } catch(Exception) { - context.API.ShowMsg(string.Format(context.API.GetTranslation("flowlauncher_plugin_url_cannot_open_url"), raw)); + context.API.ShowMsgError(string.Format(context.API.GetTranslation("flowlauncher_plugin_url_cannot_open_url"), raw)); return false; } } From d7e09abde36af13ce6d8ded99c335a2bf61d4625 Mon Sep 17 00:00:00 2001 From: Jack Ye <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:52:39 +0800 Subject: [PATCH 07/10] Fix translations Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml index f27361c507d..2fb9c6b67be 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml @@ -18,5 +18,5 @@ Copy the command Only show number of most used commands: Command not found: {0} - Error running the command: {0}" + Error running the command: {0} From 1c76114bb075baf8337ebe5658ff9c145741cfe2 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:53:14 +0800 Subject: [PATCH 08/10] Fix translations --- Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml index 8f98213a490..56471417309 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml @@ -9,7 +9,7 @@ Failed to set url in clipboard - " + Bookmark Data Open bookmarks in: From e931f3ae41c89c49cffb69d59685b1b8e2f71076 Mon Sep 17 00:00:00 2001 From: Jack Ye <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:57:04 +0800 Subject: [PATCH 09/10] Fix translations Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index 3a527090509..a0832e75691 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -446,7 +446,9 @@ public static void StartProcess(Func runProcess, Proc var title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error"); var message = string.Format(Context.API.GetTranslation("flowlauncher_plugin_program_run_failed"), info.FileName); - Context.API.ShowMsgError(title, string.Format(message, info.FileName)); +@@ Plugins/Flow.Launcher.Plugin.Program/Main.cs:449 +- Context.API.ShowMsgError(title, string.Format(message, info.FileName)); ++ Context.API.ShowMsgError(title, message); } } From d71d3a5094fca474d1801ae21b1b8ed9c8a8b089 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 20 Jul 2025 12:57:56 +0800 Subject: [PATCH 10/10] Fix build issue --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index a0832e75691..73d893858c3 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -446,9 +446,7 @@ public static void StartProcess(Func runProcess, Proc var title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error"); var message = string.Format(Context.API.GetTranslation("flowlauncher_plugin_program_run_failed"), info.FileName); -@@ Plugins/Flow.Launcher.Plugin.Program/Main.cs:449 -- Context.API.ShowMsgError(title, string.Format(message, info.FileName)); -+ Context.API.ShowMsgError(title, message); + Context.API.ShowMsgError(title, message); } }