[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>
This commit is contained in:
Davide Giacometti 2024-09-23 16:50:53 +02:00 committed by GitHub
parent 688d7d9c85
commit 035d70dd04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 7 deletions

View File

@ -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));
}
}

View File

@ -142,7 +142,7 @@ namespace PowerLauncher.Properties {
}
/// <summary>
/// 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}.
/// </summary>
public static string FailedToInitializePluginsDescription {
get {
@ -151,7 +151,16 @@ namespace PowerLauncher.Properties {
}
/// <summary>
/// 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.).
/// </summary>
public static string FailedToInitializePluginsDescriptionPartTwo {
get {
return ResourceManager.GetString("FailedToInitializePluginsDescriptionPartTwo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PowerToys Run - Plugin Initialization Error.
/// </summary>
public static string FailedToInitializePluginsTitle {
get {
@ -195,6 +204,15 @@ namespace PowerLauncher.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to PowerToys Run - Hotkey Error.
/// </summary>
public static string RegisterHotkeyFailedTitle {
get {
return ResourceManager.GetString("RegisterHotkeyFailedTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please file a bug in the.
/// </summary>

View File

@ -186,10 +186,11 @@
<value>Settings will be reset to default and program will continue to function.</value>
</data>
<data name="FailedToInitializePluginsDescription" xml:space="preserve">
<value>Plugins: {0} - fail to load and would be disabled, please contact plugins creator for help</value>
<value>Fail to initialize plugins: {0}</value>
</data>
<data name="FailedToInitializePluginsTitle" xml:space="preserve">
<value>Fail to initialize plugins</value>
<value>PowerToys Run - Plugin Initialization Error</value>
<comment>Don't translate "PowerToys Run". This is a product name.</comment>
</data>
<data name="ContextMenuItemsAvailable" xml:space="preserve">
<value>Appended controls available</value>
@ -197,4 +198,12 @@
<data name="PluginKeywords" xml:space="preserve">
<value>Plugin keywords</value>
</data>
<data name="RegisterHotkeyFailedTitle" xml:space="preserve">
<value>PowerToys Run - Hotkey Error</value>
<comment>Don't translate "PowerToys Run". This is a product name.</comment>
</data>
<data name="FailedToInitializePluginsDescriptionPartTwo" xml:space="preserve">
<value>Please report the bug to https://aka.ms/powerToysReportBug. (For third-party plugins, please contact the plugin author.)</value>
<comment>"https://aka.ms/powerToysReportBug" is a web uri.</comment>
</data>
</root>

View File

@ -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);
}
}