From c1a80a20016788b24a387a71936f5ff70290ca07 Mon Sep 17 00:00:00 2001
From: Heiko <61519853+htcfreek@users.noreply.github.com>
Date: Mon, 27 Dec 2021 21:20:11 +0100
Subject: [PATCH] [PT Run] Web-search plugin: Fix strings and improve log msg
(#15144)
* string fixes
* fix msg ending
* improve log
* Move failed message dot
---
.../Main.cs | 15 ++++++++++++---
.../Properties/Resources.Designer.cs | 13 +++++++++++--
.../Properties/Resources.resx | 4 ++--
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs
index c03498d025..1c05b18472 100644
--- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs
+++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs
@@ -83,9 +83,12 @@ namespace Community.PowerToys.Run.Plugin.WebSearch
{
if (!Helper.OpenInShell(_browserPath, arguments))
{
+ string errorMsgString = string.Format(CultureInfo.CurrentCulture, Properties.Resources.plugin_search_failed, _browserName);
+
+ Log.Error(errorMsgString, GetType());
_context.API.ShowMsg(
$"Plugin: {Properties.Resources.plugin_name}",
- $"{Properties.Resources.plugin_search_failed}: ");
+ errorMsgString);
return false;
}
@@ -124,9 +127,12 @@ namespace Community.PowerToys.Run.Plugin.WebSearch
{
if (!Helper.OpenInShell(_browserPath, arguments))
{
+ string errorMsgString = string.Format(CultureInfo.CurrentCulture, Properties.Resources.plugin_search_failed, _browserName);
+
+ Log.Error(errorMsgString, GetType());
_context.API.ShowMsg(
$"Plugin: {Properties.Resources.plugin_name}",
- $"{Properties.Resources.plugin_search_failed}: ");
+ errorMsgString);
return false;
}
@@ -141,9 +147,12 @@ namespace Community.PowerToys.Run.Plugin.WebSearch
{
if (!Helper.OpenInShell(url))
{
+ string errorMsgString = string.Format(CultureInfo.CurrentCulture, Properties.Resources.plugin_search_failed, _browserName);
+
+ Log.Error(errorMsgString, GetType());
_context.API.ShowMsg(
$"Plugin: {Properties.Resources.plugin_name}",
- $"{Properties.Resources.plugin_search_failed}: ");
+ errorMsgString);
return false;
}
diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.Designer.cs b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.Designer.cs
index c10c4118ab..d5f997b203 100644
--- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.Designer.cs
+++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.Designer.cs
@@ -70,7 +70,7 @@ namespace Community.PowerToys.Run.Plugin.WebSearch.Properties {
}
///
- /// Looks up a localized string similar to Search the web..
+ /// Looks up a localized string similar to Search the web in your default browser using your default search engine..
///
public static string plugin_description {
get {
@@ -87,6 +87,15 @@ namespace Community.PowerToys.Run.Plugin.WebSearch.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to In the default browser.
+ ///
+ public static string plugin_in_browser {
+ get {
+ return ResourceManager.GetString("plugin_in_browser", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to In {0}.
///
@@ -115,7 +124,7 @@ namespace Community.PowerToys.Run.Plugin.WebSearch.Properties {
}
///
- /// Looks up a localized string similar to Failed to open the default browser.
+ /// Looks up a localized string similar to Failed to open {0}..
///
public static string plugin_search_failed {
get {
diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.resx b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.resx
index 05de32d75c..4fa0bf4138 100644
--- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.resx
+++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Properties/Resources.resx
@@ -121,7 +121,7 @@
the default browser
- Search the web.
+ Search the web in your default browser using your default search engine.
Don't include in global results on queries that are URIs
@@ -140,6 +140,6 @@
Search the web in {0}
- Failed to open the default browser
+ Failed to open {0}.
\ No newline at end of file