From 035d70dd0434062be3bfa04a2f0a6300f092a081 Mon Sep 17 00:00:00 2001 From: Davide Giacometti <25966642+davidegiacometti@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:50:53 +0200 Subject: [PATCH] [PTRun]Improve error MessageBox title and message (#34564) * include utility name in error MessageBox for better context * aligned loading/init error messages * Update src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs --------- Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> --- .../PowerLauncher/Plugin/PluginManager.cs | 4 ++-- .../Properties/Resources.Designer.cs | 22 +++++++++++++++++-- .../PowerLauncher/Properties/Resources.resx | 13 +++++++++-- .../PowerLauncher/ViewModel/MainViewModel.cs | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs index a389dcd374..4cd6c1f15e 100644 --- a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs +++ b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs @@ -184,8 +184,8 @@ namespace PowerLauncher.Plugin if (!failedPlugins.IsEmpty) { - var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name)); - var description = string.Format(CultureInfo.CurrentCulture, FailedToInitializePluginsDescription, failed); + var failed = string.Join(", ", failedPlugins.Select(x => x.Metadata.Name)); + var description = $"{string.Format(CultureInfo.CurrentCulture, FailedToInitializePluginsDescription, failed)}\n\n{Resources.FailedToInitializePluginsDescriptionPartTwo}"; Application.Current.Dispatcher.InvokeAsync(() => API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false)); } } diff --git a/src/modules/launcher/PowerLauncher/Properties/Resources.Designer.cs b/src/modules/launcher/PowerLauncher/Properties/Resources.Designer.cs index b460bfd416..d4c435a900 100644 --- a/src/modules/launcher/PowerLauncher/Properties/Resources.Designer.cs +++ b/src/modules/launcher/PowerLauncher/Properties/Resources.Designer.cs @@ -142,7 +142,7 @@ namespace PowerLauncher.Properties { } /// - /// Looks up a localized string similar to Plugins: {0} - fail to load and would be disabled, please contact plugins creator for help. + /// Looks up a localized string similar to Fail to initialize plugins: {0}. /// public static string FailedToInitializePluginsDescription { get { @@ -151,7 +151,16 @@ namespace PowerLauncher.Properties { } /// - /// Looks up a localized string similar to Fail to initialize plugins. + /// Looks up a localized string similar to Please report the bug to https://aka.ms/powerToysReportBug. (For third-party plugins, please contact the plugin author.). + /// + public static string FailedToInitializePluginsDescriptionPartTwo { + get { + return ResourceManager.GetString("FailedToInitializePluginsDescriptionPartTwo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PowerToys Run - Plugin Initialization Error. /// public static string FailedToInitializePluginsTitle { get { @@ -195,6 +204,15 @@ namespace PowerLauncher.Properties { } } + /// + /// Looks up a localized string similar to PowerToys Run - Hotkey Error. + /// + public static string RegisterHotkeyFailedTitle { + get { + return ResourceManager.GetString("RegisterHotkeyFailedTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please file a bug in the. /// diff --git a/src/modules/launcher/PowerLauncher/Properties/Resources.resx b/src/modules/launcher/PowerLauncher/Properties/Resources.resx index c2b859f6e3..421919bb13 100644 --- a/src/modules/launcher/PowerLauncher/Properties/Resources.resx +++ b/src/modules/launcher/PowerLauncher/Properties/Resources.resx @@ -186,10 +186,11 @@ Settings will be reset to default and program will continue to function. - Plugins: {0} - fail to load and would be disabled, please contact plugins creator for help + Fail to initialize plugins: {0} - Fail to initialize plugins + PowerToys Run - Plugin Initialization Error + Don't translate "PowerToys Run". This is a product name. Appended controls available @@ -197,4 +198,12 @@ Plugin keywords + + PowerToys Run - Hotkey Error + Don't translate "PowerToys Run". This is a product name. + + + Please report the bug to https://aka.ms/powerToysReportBug. (For third-party plugins, please contact the plugin author.) + "https://aka.ms/powerToysReportBug" is a web uri. + \ No newline at end of file diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index d2ff39b08b..809c660cd1 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -910,7 +910,7 @@ namespace PowerLauncher.ViewModel catch (Exception) { string errorMsg = string.Format(CultureInfo.InvariantCulture, RegisterHotkeyFailed, hotkeyStr); - MessageBox.Show(errorMsg); + MessageBox.Show(errorMsg, Properties.Resources.RegisterHotkeyFailedTitle); } }