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 <paul.de.man@gmail.com>
This commit is contained in:
P-Storm
2020-10-06 18:08:41 +02:00
committed by GitHub
parent ac3910580a
commit 206397dc86
7 changed files with 36 additions and 8 deletions

View File

@@ -106,7 +106,7 @@ namespace Microsoft.Plugin.Folder.Properties {
} }
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
public static string Microsoft_plugin_folder_truncation_warning_subtitle { public static string Microsoft_plugin_folder_truncation_warning_subtitle {
get { get {
@@ -141,6 +141,15 @@ namespace Microsoft.Plugin.Folder.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to File: {0}.
/// </summary>
public static string wox_plugin_folder_select_file_result_subtitle {
get {
return ResourceManager.GetString("wox_plugin_folder_select_file_result_subtitle", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Use &gt; to search within the directory. Use * to search for file extensions. Or use both &gt;*. /// Looks up a localized string similar to Use &gt; to search within the directory. Use * to search for file extensions. Or use both &gt;*.
/// </summary> /// </summary>
@@ -167,5 +176,14 @@ namespace Microsoft.Plugin.Folder.Properties {
return ResourceManager.GetString("wox_plugin_folder_select_folder_OpenFileOrFolder_error_message", resourceCulture); return ResourceManager.GetString("wox_plugin_folder_select_folder_OpenFileOrFolder_error_message", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to Folder: {0}.
/// </summary>
public static string wox_plugin_folder_select_folder_result_subtitle {
get {
return ResourceManager.GetString("wox_plugin_folder_select_folder_result_subtitle", resourceCulture);
}
}
} }
} }

View File

@@ -136,7 +136,7 @@
<value>Warning: Folder Plugin Results truncated.</value> <value>Warning: Folder Plugin Results truncated.</value>
</data> </data>
<data name="Microsoft_plugin_folder_truncation_warning_subtitle" xml:space="preserve"> <data name="Microsoft_plugin_folder_truncation_warning_subtitle" xml:space="preserve">
<value>Showing {0} of {1} results</value> <value>Showing {0:N0} of {1:N0} results</value>
</data> </data>
<data name="Microsoft_plugin_folder_clipboard_failed" xml:space="preserve"> <data name="Microsoft_plugin_folder_clipboard_failed" xml:space="preserve">
<value>Fail to set text in clipboard</value> <value>Fail to set text in clipboard</value>
@@ -153,4 +153,10 @@
<data name="wox_plugin_folder_select_folder_OpenFileOrFolder_error_message" xml:space="preserve"> <data name="wox_plugin_folder_select_folder_OpenFileOrFolder_error_message" xml:space="preserve">
<value>Could not start</value> <value>Could not start</value>
</data> </data>
<data name="wox_plugin_folder_select_file_result_subtitle" xml:space="preserve">
<value>File: {0}</value>
</data>
<data name="wox_plugin_folder_select_folder_result_subtitle" xml:space="preserve">
<value>Folder: {0}</value>
</data>
</root> </root>

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Globalization;
using Wox.Plugin; using Wox.Plugin;
namespace Microsoft.Plugin.Folder.Sources.Result namespace Microsoft.Plugin.Folder.Sources.Result
@@ -27,9 +28,9 @@ namespace Microsoft.Plugin.Folder.Sources.Result
{ {
return new Wox.Plugin.Result return new Wox.Plugin.Result
{ {
Title = $"Open {Search}", Title = Properties.Resources.wox_plugin_folder_select_folder_first_result_title,
QueryTextDisplay = Search, 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, IcoPath = Search,
Score = 500, Score = 500,
Action = c => _explorerAction.ExecuteSanitized(Search, contextApi), Action = c => _explorerAction.ExecuteSanitized(Search, contextApi),

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Globalization;
using System.IO; using System.IO;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Plugin; using Wox.Plugin;
@@ -23,7 +24,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
var result = new Wox.Plugin.Result var result = new Wox.Plugin.Result
{ {
Title = Title, Title = Title,
SubTitle = "Folder: " + FilePath, SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath),
IcoPath = FilePath, IcoPath = FilePath,
TitleHighlightData = StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData, TitleHighlightData = StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData,
Action = c => ExplorerAction.Execute(FilePath, contextApi), Action = c => ExplorerAction.Execute(FilePath, contextApi),

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Globalization;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Plugin; using Wox.Plugin;
@@ -36,7 +37,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
{ {
Title = Title, Title = Title,
IcoPath = Path, IcoPath = Path,
SubTitle = "Folder: " + Subtitle, SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
QueryTextDisplay = Path, QueryTextDisplay = Path,
TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData, TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path }, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },

View File

@@ -23,7 +23,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
{ {
Title = Properties.Resources.Microsoft_plugin_folder_truncation_warning_title, Title = Properties.Resources.Microsoft_plugin_folder_truncation_warning_title,
QueryTextDisplay = Search, 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, IcoPath = WarningIconPath,
}; };
} }

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Globalization;
using Microsoft.Plugin.Folder.Sources; using Microsoft.Plugin.Folder.Sources;
using Microsoft.Plugin.Folder.Sources.Result; using Microsoft.Plugin.Folder.Sources.Result;
using Wox.Infrastructure; using Wox.Infrastructure;
@@ -27,7 +28,7 @@ namespace Microsoft.Plugin.Folder
{ {
Title = Title, Title = Title,
IcoPath = Path, IcoPath = Path,
SubTitle = $"Folder: {Subtitle}", SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
QueryTextDisplay = Path, QueryTextDisplay = Path,
TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData, TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path }, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },