From 206397dc869bff0a2bfa78e2c5e2127a431b0e23 Mon Sep 17 00:00:00 2001 From: P-Storm Date: Tue, 6 Oct 2020 18:08:41 +0200 Subject: [PATCH] Fixed the error that Files were named Folder (#6935) * Fixed the error that Files were named Folder * Add and use resources in Results. * Last item without resources in Plugin.Folder * Changed to CurrentCulture, added N0 to Folder truncate warning. Co-authored-by: p-storm --- .../Properties/Resources.Designer.cs | 20 ++++++++++++++++++- .../Properties/Resources.resx | 8 +++++++- .../Result/CreateOpenCurrentFolderResult.cs | 5 +++-- .../Sources/Result/FileItemResult.cs | 3 ++- .../Sources/Result/FolderItemResult.cs | 3 ++- .../Sources/Result/TruncatedItemResult.cs | 2 +- .../UserFolderResult.cs | 3 ++- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.Designer.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.Designer.cs index 57df8b9a14..8e429befb8 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.Designer.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.Designer.cs @@ -106,7 +106,7 @@ namespace Microsoft.Plugin.Folder.Properties { } /// - /// Looks up a localized string similar to Showing {0} of {1} results. + /// Looks up a localized string similar to Showing {0:N0} of {1:N0} results. /// public static string Microsoft_plugin_folder_truncation_warning_subtitle { get { @@ -141,6 +141,15 @@ namespace Microsoft.Plugin.Folder.Properties { } } + /// + /// Looks up a localized string similar to File: {0}. + /// + public static string wox_plugin_folder_select_file_result_subtitle { + get { + return ResourceManager.GetString("wox_plugin_folder_select_file_result_subtitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use > to search within the directory. Use * to search for file extensions. Or use both >*. /// @@ -167,5 +176,14 @@ namespace Microsoft.Plugin.Folder.Properties { return ResourceManager.GetString("wox_plugin_folder_select_folder_OpenFileOrFolder_error_message", resourceCulture); } } + + /// + /// Looks up a localized string similar to Folder: {0}. + /// + public static string wox_plugin_folder_select_folder_result_subtitle { + get { + return ResourceManager.GetString("wox_plugin_folder_select_folder_result_subtitle", resourceCulture); + } + } } } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.resx b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.resx index 61ae61d859..adc945ecba 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.resx +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Properties/Resources.resx @@ -136,7 +136,7 @@ Warning: Folder Plugin Results truncated. - Showing {0} of {1} results + Showing {0:N0} of {1:N0} results Fail to set text in clipboard @@ -153,4 +153,10 @@ Could not start + + File: {0} + + + Folder: {0} + \ No newline at end of file diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/CreateOpenCurrentFolderResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/CreateOpenCurrentFolderResult.cs index 9fc916537d..86c60b0cec 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/CreateOpenCurrentFolderResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/CreateOpenCurrentFolderResult.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Globalization; using Wox.Plugin; namespace Microsoft.Plugin.Folder.Sources.Result @@ -27,9 +28,9 @@ namespace Microsoft.Plugin.Folder.Sources.Result { return new Wox.Plugin.Result { - Title = $"Open {Search}", + Title = Properties.Resources.wox_plugin_folder_select_folder_first_result_title, QueryTextDisplay = Search, - SubTitle = $"Folder: Use > to search within the directory. Use * to search for file extensions. Or use both >*.", + SubTitle = Properties.Resources.wox_plugin_folder_select_folder_first_result_subtitle, IcoPath = Search, Score = 500, Action = c => _explorerAction.ExecuteSanitized(Search, contextApi), diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs index 784358d3d1..84a35e1396 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Globalization; using System.IO; using Wox.Infrastructure; using Wox.Plugin; @@ -23,7 +24,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result var result = new Wox.Plugin.Result { Title = Title, - SubTitle = "Folder: " + FilePath, + SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath), IcoPath = FilePath, TitleHighlightData = StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData, Action = c => ExplorerAction.Execute(FilePath, contextApi), diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs index d42da8cc3f..ad5f1e7f5e 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Globalization; using Wox.Infrastructure; using Wox.Plugin; @@ -36,7 +37,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result { Title = Title, IcoPath = Path, - SubTitle = "Folder: " + Subtitle, + SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle), QueryTextDisplay = Path, TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path }, diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs index c09a68dc29..bbb68cc122 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs @@ -23,7 +23,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result { Title = Properties.Resources.Microsoft_plugin_folder_truncation_warning_title, QueryTextDisplay = Search, - SubTitle = string.Format(CultureInfo.InvariantCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount), + SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount), IcoPath = WarningIconPath, }; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs index 47ae19f545..01ccb56bee 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Globalization; using Microsoft.Plugin.Folder.Sources; using Microsoft.Plugin.Folder.Sources.Result; using Wox.Infrastructure; @@ -27,7 +28,7 @@ namespace Microsoft.Plugin.Folder { Title = Title, IcoPath = Path, - SubTitle = $"Folder: {Subtitle}", + SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle), QueryTextDisplay = Path, TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },