From ccac84c0f3b5282162fc597904738d29c0b4b610 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 15:15:11 +0800
Subject: [PATCH] Fix hardcoded strings
---
.../Languages/en.xaml | 5 +++++
.../Search/ResultManager.cs | 22 +++++--------------
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index 94b46b230..265b26296 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -99,6 +99,11 @@
Remove from Quick Access
Remove current result from Quick Access
Show Windows Context Menu
+
+
+ {0} free of {1}
+ Open in Default File Manager
+ Use '>' to search in this directory, '*' to search for file extensions or '>*' to combine both searches.
Failed to load Everything SDK
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 88bfecc14..214a779e4 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -96,7 +96,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var driveLetter = path[..1].ToUpper();
var driveName = driveLetter + ":\\";
DriveInfo drv = new DriveInfo(driveLetter);
- var subtitle = ToReadableSize(drv.AvailableFreeSpace, 2) + " free of " + ToReadableSize(drv.TotalSize, 2);
+ var freespace = ToReadableSize(drv.AvailableFreeSpace, 2);
+ var totalspace = ToReadableSize(drv.TotalSize, 2);
+ var subtitle = string.Format(Context.API.GetTranslation("plugin_explorer_diskfreespace"), freespace, totalspace);
double usingSize = (Convert.ToDouble(drv.TotalSize) - Convert.ToDouble(drv.AvailableFreeSpace)) / Convert.ToDouble(drv.TotalSize) * 100;
int? progressValue = Convert.ToInt32(usingSize);
@@ -170,25 +172,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
// Path passed from PathSearchAsync ends with Constants.DirectorySeperator ('\'), need to remove the seperator
// so it's consistent with folder results returned by index search which does not end with one
var folderPath = path.TrimEnd(Constants.DirectorySeperator);
-
- var folderName = folderPath.TrimEnd(Constants.DirectorySeperator).Split(new[]
- {
- Path.DirectorySeparatorChar
- }, StringSplitOptions.None).Last();
-
- var title = $"Open {folderName}";
-
- var subtitleFolderName = folderName;
-
- // ie. max characters can be displayed without subtitle cutting off: "Program Files (x86)"
- if (folderName.Length > 19)
- subtitleFolderName = "the directory";
return new Result
{
- Title = title,
- SubTitle = $"Use > to search within {subtitleFolderName}, " +
- $"* to search for file extensions or >* to combine both searches.",
+ Title = Context.API.GetTranslation("plugin_explorer_openresultfolder"),
+ SubTitle = Context.API.GetTranslation("plugin_explorer_openresultfolder_subtitle"),
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
IcoPath = folderPath,
Score = 500,