mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use Flow.Launcher.Localization to improve code quality
This commit is contained in:
parent
a2c11af82b
commit
78e5bf2a60
16 changed files with 134 additions and 153 deletions
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.5" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.9" />
|
||||
<PackageReference Include="Svg.Skia" Version="3.0.6" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.0" />
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.5" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
|
||||
<PackageReference Include="Mages" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"),
|
||||
Title = Localize.plugin_explorer_add_to_quickaccess_title(),
|
||||
SubTitle = Localize.plugin_explorer_add_to_quickaccess_subtitle(),
|
||||
Action = (context) =>
|
||||
{
|
||||
Settings.QuickAccessLinks.Add(new AccessLink
|
||||
|
|
@ -77,16 +77,14 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
Type = record.Type
|
||||
});
|
||||
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
|
||||
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
|
||||
Context.API.ShowMsg(Localize.plugin_explorer_addfilefoldersuccess(),
|
||||
Localize.plugin_explorer_addfilefoldersuccess_detail(),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
return true;
|
||||
},
|
||||
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
|
||||
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
|
||||
SubTitleToolTip = Localize.plugin_explorer_contextmenu_titletooltip(),
|
||||
TitleToolTip = Localize.plugin_explorer_contextmenu_titletooltip(),
|
||||
IcoPath = Constants.QuickAccessImagePath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue718"),
|
||||
});
|
||||
|
|
@ -95,22 +93,20 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_title"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"),
|
||||
Title = Localize.plugin_explorer_remove_from_quickaccess_title(),
|
||||
SubTitle = Localize.plugin_explorer_remove_from_quickaccess_subtitle(),
|
||||
Action = (context) =>
|
||||
{
|
||||
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
|
||||
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
|
||||
Context.API.ShowMsg(Localize.plugin_explorer_removefilefoldersuccess(),
|
||||
Localize.plugin_explorer_removefilefoldersuccess_detail(),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
return true;
|
||||
},
|
||||
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
|
||||
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
|
||||
SubTitleToolTip = Localize.plugin_explorer_contextmenu_remove_titletooltip(),
|
||||
TitleToolTip = Localize.plugin_explorer_contextmenu_remove_titletooltip(),
|
||||
IcoPath = Constants.RemoveQuickAccessImagePath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uecc9")
|
||||
});
|
||||
|
|
@ -118,8 +114,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_copypath"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_copypath_subtitle"),
|
||||
Title = Localize.plugin_explorer_copypath(),
|
||||
SubTitle = Localize.plugin_explorer_copypath_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
|
|
@ -130,7 +126,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
catch (Exception e)
|
||||
{
|
||||
LogException("Fail to set text in clipboard", e);
|
||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_text"));
|
||||
Context.API.ShowMsgError(Localize.plugin_explorer_fail_to_set_text());
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
|
@ -140,8 +136,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_copyname"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_copyname_subtitle"),
|
||||
Title = Localize.plugin_explorer_copyname(),
|
||||
SubTitle = Localize.plugin_explorer_copyname_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
|
|
@ -152,7 +148,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
catch (Exception e)
|
||||
{
|
||||
LogException("Fail to set text in clipboard", e);
|
||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_text"));
|
||||
Context.API.ShowMsgError(Localize.plugin_explorer_fail_to_set_text());
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
|
@ -162,8 +158,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder"),
|
||||
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_copyfile_subtitle") : Context.API.GetTranslation("plugin_explorer_copyfolder_subtitle"),
|
||||
Title = Localize.plugin_explorer_copyfilefolder(),
|
||||
SubTitle = isFile ? Localize.plugin_explorer_copyfile_subtitle(): Localize.plugin_explorer_copyfolder_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
|
|
@ -174,28 +170,26 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
catch (Exception e)
|
||||
{
|
||||
LogException($"Fail to set file/folder in clipboard", e);
|
||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_explorer_fail_to_set_files"));
|
||||
Context.API.ShowMsgError(Localize.plugin_explorer_fail_to_set_files());
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
IcoPath = icoPath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uf12b")
|
||||
});
|
||||
|
||||
|
||||
if (record.Type is ResultType.File or ResultType.Folder)
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder"),
|
||||
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_deletefile_subtitle") : Context.API.GetTranslation("plugin_explorer_deletefolder_subtitle"),
|
||||
Title = Localize.plugin_explorer_deletefilefolder(),
|
||||
SubTitle = isFile ? Localize.plugin_explorer_deletefile_subtitle(): Localize.plugin_explorer_deletefolder_subtitle(),
|
||||
Action = (context) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Context.API.ShowMsgBox(
|
||||
string.Format(Context.API.GetTranslation("plugin_explorer_delete_folder_link"), record.FullPath),
|
||||
Context.API.GetTranslation("plugin_explorer_deletefilefolder"),
|
||||
Localize.plugin_explorer_delete_folder_link(record.FullPath),
|
||||
Localize.plugin_explorer_deletefilefolder(),
|
||||
MessageBoxButton.OKCancel,
|
||||
MessageBoxImage.Warning)
|
||||
== MessageBoxResult.Cancel)
|
||||
|
|
@ -208,15 +202,15 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"),
|
||||
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), record.FullPath),
|
||||
Context.API.ShowMsg(Localize.plugin_explorer_deletefilefoldersuccess(),
|
||||
Localize.plugin_explorer_deletefilefoldersuccess_detail(record.FullPath),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException($"Fail to delete {record.FullPath}", e);
|
||||
Context.API.ShowMsgError(string.Format(Context.API.GetTranslation("plugin_explorer_fail_to_delete"), record.FullPath));
|
||||
Context.API.ShowMsgError(Localize.plugin_explorer_fail_to_delete(record.FullPath));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +224,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
contextMenus.Add(new Result()
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_show_contextmenu_title"),
|
||||
Title = Localize.plugin_explorer_show_contextmenu_title(),
|
||||
IcoPath = Constants.ShowContextMenuImagePath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue700"),
|
||||
Action = _ =>
|
||||
|
|
@ -248,8 +242,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
if (record.Type == ResultType.File && CanRunAsDifferentUser(record.FullPath))
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_runasdifferentuser"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_runasdifferentuser_subtitle"),
|
||||
Title = Localize.plugin_explorer_runasdifferentuser(),
|
||||
SubTitle = Localize.plugin_explorer_runasdifferentuser_subtitle(),
|
||||
Action = (context) =>
|
||||
{
|
||||
try
|
||||
|
|
@ -259,8 +253,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
catch (FileNotFoundException e)
|
||||
{
|
||||
Context.API.ShowMsgError(
|
||||
Context.API.GetTranslation("plugin_explorer_plugin_name"),
|
||||
string.Format(Context.API.GetTranslation("plugin_explorer_file_not_found"), e.Message));
|
||||
Localize.plugin_explorer_plugin_name(),
|
||||
Localize.plugin_explorer_file_not_found(e.Message));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -317,8 +311,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_opencontainingfolder"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_opencontainingfolder_subtitle"),
|
||||
Title = Localize.plugin_explorer_opencontainingfolder(),
|
||||
SubTitle = Localize.plugin_explorer_opencontainingfolder_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
|
|
@ -328,7 +322,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
catch (Exception e)
|
||||
{
|
||||
LogException($"Fail to open file at {record.FullPath}", e);
|
||||
Context.API.ShowMsgError(string.Format(Context.API.GetTranslation("plugin_explorer_fail_to_open"), record.FullPath));
|
||||
Context.API.ShowMsgError(Localize.plugin_explorer_fail_to_open(record.FullPath));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -339,11 +333,9 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Result CreateOpenWithEditorResult(SearchResult record, string editorPath)
|
||||
{
|
||||
var name = $"{Context.API.GetTranslation("plugin_explorer_openwitheditor")} {Path.GetFileNameWithoutExtension(editorPath)}";
|
||||
var name = $"{Localize.plugin_explorer_openwitheditor()} {Path.GetFileNameWithoutExtension(editorPath)}";
|
||||
|
||||
return new Result
|
||||
{
|
||||
|
|
@ -361,8 +353,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var raw_message = Context.API.GetTranslation("plugin_explorer_openwitheditor_error");
|
||||
var message = string.Format(raw_message, record.FullPath, Path.GetFileNameWithoutExtension(editorPath), editorPath);
|
||||
var message = Localize.plugin_explorer_openwitheditor_error(record.FullPath, Path.GetFileNameWithoutExtension(editorPath), editorPath);
|
||||
LogException(message, e);
|
||||
Context.API.ShowMsgError(message);
|
||||
return false;
|
||||
|
|
@ -377,7 +368,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
string shellPath = Settings.ShellPath;
|
||||
|
||||
var name = $"{Context.API.GetTranslation("plugin_explorer_openwithshell")} {Path.GetFileNameWithoutExtension(shellPath)}";
|
||||
var name = $"{Localize.plugin_explorer_openwithshell()} {Path.GetFileNameWithoutExtension(shellPath)}";
|
||||
|
||||
return new Result
|
||||
{
|
||||
|
|
@ -394,8 +385,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var raw_message = Context.API.GetTranslation("plugin_explorer_openwithshell_error");
|
||||
var message = string.Format(raw_message, record.FullPath, Path.GetFileNameWithoutExtension(shellPath), shellPath);
|
||||
var message = Localize.plugin_explorer_openwithshell_error(record.FullPath, Path.GetFileNameWithoutExtension(shellPath), shellPath);
|
||||
LogException(message, e);
|
||||
Context.API.ShowMsgError(message);
|
||||
return false;
|
||||
|
|
@ -410,8 +400,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_excludefromindexsearch"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_path") + " " + record.FullPath,
|
||||
Title = Localize.plugin_explorer_excludefromindexsearch(),
|
||||
SubTitle = Localize.plugin_explorer_path()+ " " + record.FullPath,
|
||||
Action = c_ =>
|
||||
{
|
||||
if (!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)))
|
||||
|
|
@ -422,8 +412,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_excludedfromindexsearch_msg"),
|
||||
Context.API.GetTranslation("plugin_explorer_path") +
|
||||
Context.API.ShowMsg(Localize.plugin_explorer_excludedfromindexsearch_msg(),
|
||||
Localize.plugin_explorer_path()+
|
||||
" " + record.FullPath, Constants.ExplorerIconImageFullPath);
|
||||
|
||||
// so the new path can be persisted to storage and not wait till next ViewModel save.
|
||||
|
|
@ -441,8 +431,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openindexingoptions"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openindexingoptions_subtitle"),
|
||||
Title = Localize.plugin_explorer_openindexingoptions(),
|
||||
SubTitle = Localize.plugin_explorer_openindexingoptions_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
|
|
@ -459,7 +449,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var message = Context.API.GetTranslation("plugin_explorer_openindexingoptions_errormsg");
|
||||
var message = Localize.plugin_explorer_openindexingoptions_errormsg();
|
||||
LogException(message, e);
|
||||
Context.API.ShowMsgError(message);
|
||||
return false;
|
||||
|
|
@ -470,12 +460,12 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
};
|
||||
}
|
||||
|
||||
private Result CreateOpenWithMenu(SearchResult record)
|
||||
private static Result CreateOpenWithMenu(SearchResult record)
|
||||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openwith"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
|
||||
Title = Localize.plugin_explorer_openwith(),
|
||||
SubTitle = Localize.plugin_explorer_openwith_subtitle(),
|
||||
Action = _ =>
|
||||
{
|
||||
Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Droplex" Version="1.7.0" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.5" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="9.0.9" />
|
||||
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
|
||||
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0" />
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
<system:String x:Key="plugin_explorer_directoryinfosearch_error">Error occurred during search: {0}</system:String>
|
||||
<system:String x:Key="plugin_explorer_opendir_error">Could not open folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_openfile_error">Could not open file</system:String>
|
||||
<system:String x:Key="plugin_explorer_new_action_keyword_assigned">This new action keyword is already assigned to another plugin, please choose a different one</system:String>
|
||||
|
||||
<!-- Controls -->
|
||||
<system:String x:Key="plugin_explorer_delete">Delete</system:String>
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
return Context.API.GetTranslation("plugin_explorer_plugin_name");
|
||||
return Localize.plugin_explorer_plugin_name();
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
return Context.API.GetTranslation("plugin_explorer_plugin_description");
|
||||
return Localize.plugin_explorer_plugin_description();
|
||||
}
|
||||
|
||||
public void OnCultureInfoChanged(CultureInfo newCulture)
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ public static class EverythingDownloadHelper
|
|||
if (string.IsNullOrEmpty(installedLocation))
|
||||
{
|
||||
if (api.ShowMsgBox(
|
||||
string.Format(api.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine),
|
||||
api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
Localize.flowlauncher_plugin_everything_installing_select(Environment.NewLine),
|
||||
Localize.flowlauncher_plugin_everything_installing_title(),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
var dlg = new System.Windows.Forms.OpenFileDialog
|
||||
{
|
||||
|
|
@ -41,13 +41,13 @@ public static class EverythingDownloadHelper
|
|||
return installedLocation;
|
||||
}
|
||||
|
||||
api.ShowMsg(api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
|
||||
api.GetTranslation("flowlauncher_plugin_everything_installing_subtitle"), "", useMainWindowAsOwner: false);
|
||||
api.ShowMsg(Localize.flowlauncher_plugin_everything_installing_title(),
|
||||
Localize.flowlauncher_plugin_everything_installing_subtitle(), "", useMainWindowAsOwner: false);
|
||||
|
||||
await DroplexPackage.Drop(App.Everything1_4_1_1009).ConfigureAwait(false);
|
||||
|
||||
api.ShowMsg(api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
|
||||
api.GetTranslation("flowlauncher_plugin_everything_installationsuccess_subtitle"), "", useMainWindowAsOwner: false);
|
||||
api.ShowMsg(Localize.flowlauncher_plugin_everything_installing_title(),
|
||||
Localize.flowlauncher_plugin_everything_installationsuccess_subtitle(), "", useMainWindowAsOwner: false);
|
||||
|
||||
installedLocation = "C:\\Program Files\\Everything\\Everything.exe";
|
||||
|
||||
|
|
@ -83,6 +83,5 @@ public static class EverythingDownloadHelper
|
|||
|
||||
var scoopInstalledPath = Environment.ExpandEnvironmentVariables(@"%userprofile%\scoop\apps\everything\current\Everything.exe");
|
||||
return File.Exists(scoopInstalledPath) ? scoopInstalledPath : string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
if (!await EverythingApi.IsEverythingRunningAsync(token))
|
||||
throw new EngineNotAvailableException(
|
||||
Enum.GetName(Settings.IndexSearchEngineOption.Everything)!,
|
||||
Main.Context.API.GetTranslation("flowlauncher_plugin_everything_click_to_launch_or_install"),
|
||||
Main.Context.API.GetTranslation("flowlauncher_plugin_everything_is_not_running"),
|
||||
Localize.flowlauncher_plugin_everything_click_to_launch_or_install(),
|
||||
Localize.flowlauncher_plugin_everything_is_not_running(),
|
||||
Constants.EverythingErrorImagePath,
|
||||
ClickToInstallEverythingAsync);
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
Enum.GetName(Settings.IndexSearchEngineOption.Everything)!,
|
||||
"Please check whether your system is x86 or x64",
|
||||
Constants.GeneralSearchErrorImagePath,
|
||||
Main.Context.API.GetTranslation("flowlauncher_plugin_everything_sdk_issue"));
|
||||
Localize.flowlauncher_plugin_everything_sdk_issue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
|
||||
if (installedPath == null)
|
||||
{
|
||||
Main.Context.API.ShowMsgError(Main.Context.API.GetTranslation("flowlauncher_plugin_everything_not_found"));
|
||||
Main.Context.API.ShowMsgError(Localize.flowlauncher_plugin_everything_not_found());
|
||||
Main.Context.API.LogError(ClassName, "Unable to find Everything.exe");
|
||||
|
||||
return false;
|
||||
|
|
@ -65,7 +65,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
// Just let the user know that Everything is not installed properly and ask them to install it manually
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.ShowMsgError(Main.Context.API.GetTranslation("flowlauncher_plugin_everything_install_issue"));
|
||||
Main.Context.API.ShowMsgError(Localize.flowlauncher_plugin_everything_install_issue());
|
||||
Main.Context.API.LogException(ClassName, "Failed to install Everything", e);
|
||||
|
||||
return false;
|
||||
|
|
@ -97,8 +97,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
if (!Settings.EnableEverythingContentSearch)
|
||||
{
|
||||
throw new EngineNotAvailableException(Enum.GetName(Settings.IndexSearchEngineOption.Everything)!,
|
||||
Main.Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search"),
|
||||
Main.Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search_tips"),
|
||||
Localize.flowlauncher_plugin_everything_enable_content_search(),
|
||||
Localize.flowlauncher_plugin_everything_enable_content_search_tips(),
|
||||
Constants.EverythingErrorImagePath,
|
||||
_ =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -124,7 +124,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
|
||||
Context.API.ShowMsgBox(ex.Message, Localize.plugin_explorer_opendir_error());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
|
||||
Context.API.ShowMsgBox(ex.Message, Localize.plugin_explorer_opendir_error());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
|
||||
Context.API.ShowMsgBox(ex.Message, Localize.plugin_explorer_opendir_error());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
return false;
|
||||
},
|
||||
Score = score,
|
||||
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenDirectory"),
|
||||
TitleToolTip = Localize.plugin_explorer_plugin_ToolTipOpenDirectory(),
|
||||
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetFolderMoreInfoTooltip(path) : path,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
|
|
@ -190,7 +190,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
DriveInfo drv = new DriveInfo(driveLetter);
|
||||
var freespace = ToReadableSize(drv.AvailableFreeSpace, 2);
|
||||
var totalspace = ToReadableSize(drv.TotalSize, 2);
|
||||
var subtitle = string.Format(Context.API.GetTranslation("plugin_explorer_diskfreespace"), freespace, totalspace);
|
||||
var subtitle = Localize.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);
|
||||
|
|
@ -262,8 +262,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openresultfolder"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openresultfolder_subtitle"),
|
||||
Title = Localize.plugin_explorer_openresultfolder(),
|
||||
SubTitle = Localize.plugin_explorer_openresultfolder_subtitle(),
|
||||
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
|
||||
IcoPath = folderPath,
|
||||
Score = 500,
|
||||
|
|
@ -330,12 +330,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
|
||||
Context.API.ShowMsgBox(ex.Message, Localize.plugin_explorer_openfile_error());
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenContainingFolder"),
|
||||
TitleToolTip = Localize.plugin_explorer_plugin_ToolTipOpenContainingFolder(),
|
||||
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetFileMoreInfoTooltip(filePath) : filePath,
|
||||
ContextData = new SearchResult { Type = ResultType.File, FullPath = filePath, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
|
|
@ -374,8 +374,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
var fileSize = PreviewPanel.GetFileSize(filePath);
|
||||
var fileCreatedAt = PreviewPanel.GetFileCreatedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
|
||||
var fileModifiedAt = PreviewPanel.GetFileLastModifiedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
|
||||
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info"),
|
||||
filePath, fileSize, fileCreatedAt, fileModifiedAt, Environment.NewLine);
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info(filePath, fileSize, fileCreatedAt, fileModifiedAt, Environment.NewLine);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -391,8 +390,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
var folderSize = PreviewPanel.GetFolderSize(folderPath);
|
||||
var folderCreatedAt = PreviewPanel.GetFolderCreatedAt(folderPath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
|
||||
var folderModifiedAt = PreviewPanel.GetFolderLastModifiedAt(folderPath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
|
||||
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info"),
|
||||
folderPath, folderSize, folderCreatedAt, folderModifiedAt, Environment.NewLine);
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info(folderPath, folderSize, folderCreatedAt, folderModifiedAt, Environment.NewLine);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -403,8 +401,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
private static string GetVolumeMoreInfoTooltip(string volumePath, string freespace, string totalspace)
|
||||
{
|
||||
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_volume"),
|
||||
volumePath, freespace, totalspace, Environment.NewLine);
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_volume(volumePath, freespace, totalspace, Environment.NewLine);
|
||||
}
|
||||
|
||||
private static readonly string[] MediaExtensions =
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
{
|
||||
new()
|
||||
{
|
||||
Title = Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search"),
|
||||
SubTitle = Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search_tips"),
|
||||
Title = Localize.flowlauncher_plugin_everything_enable_content_search(),
|
||||
SubTitle = Localize.flowlauncher_plugin_everything_enable_content_search_tips(),
|
||||
IcoPath = "Images/index_error.png",
|
||||
Action = c =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
|||
|
||||
throw new EngineNotAvailableException(
|
||||
"Windows Index",
|
||||
Main.Context.API.GetTranslation("plugin_explorer_windowsSearchServiceFix"),
|
||||
Main.Context.API.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"),
|
||||
Localize.plugin_explorer_windowsSearchServiceFix(),
|
||||
Localize.plugin_explorer_windowsSearchServiceNotRunning(),
|
||||
Constants.WindowsIndexErrorImagePath,
|
||||
c =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
public int MaxResult { get; set; } = 100;
|
||||
|
||||
public ObservableCollection<AccessLink> QuickAccessLinks { get; set; } = new();
|
||||
public ObservableCollection<AccessLink> QuickAccessLinks { get; set; } = [];
|
||||
|
||||
public ObservableCollection<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new ObservableCollection<AccessLink>();
|
||||
public ObservableCollection<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = [];
|
||||
|
||||
public string EditorPath { get; set; } = "";
|
||||
|
||||
|
|
@ -58,7 +58,6 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
public bool QuickAccessKeywordEnabled { get; set; }
|
||||
|
||||
|
||||
public bool WarnWindowsSearchServiceOff { get; set; } = true;
|
||||
|
||||
public bool ShowFileSizeInPreviewPanel { get; set; } = true;
|
||||
|
|
@ -69,7 +68,6 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
public bool ShowFileAgeInPreviewPanel { get; set; } = false;
|
||||
|
||||
|
||||
public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd";
|
||||
|
||||
public string PreviewPanelTimeFormat { get; set; } = "HH:mm";
|
||||
|
|
@ -82,8 +80,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
private EverythingSearchManager EverythingManagerInstance => _everythingManagerInstance ??= new EverythingSearchManager(this);
|
||||
private WindowsIndexSearchManager WindowsIndexSearchManager => _windowsIndexSearchManager ??= new WindowsIndexSearchManager(this);
|
||||
|
||||
|
||||
public IndexSearchEngineOption IndexSearchEngine { get; set; } = IndexSearchEngineOption.WindowsIndex;
|
||||
|
||||
[JsonIgnore]
|
||||
public IIndexProvider IndexProvider => IndexSearchEngine switch
|
||||
{
|
||||
|
|
@ -139,7 +137,6 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Everything Settings
|
||||
|
||||
public string EverythingInstalledPath { get; set; }
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
return;
|
||||
}
|
||||
|
||||
var actionKeywordWindow = new ActionKeywordSetting(actionKeyword, Context.API);
|
||||
var actionKeywordWindow = new ActionKeywordSetting(actionKeyword);
|
||||
|
||||
if (!(actionKeywordWindow.ShowDialog() ?? false))
|
||||
{
|
||||
|
|
@ -432,8 +432,8 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
case "QuickAccessLink":
|
||||
if (SelectedQuickAccessLink == null) return;
|
||||
if (Context.API.ShowMsgBox(
|
||||
Context.API.GetTranslation("plugin_explorer_delete_quick_access_link"),
|
||||
Context.API.GetTranslation("plugin_explorer_delete"),
|
||||
Localize.plugin_explorer_delete_quick_access_link(),
|
||||
Localize.plugin_explorer_delete(),
|
||||
MessageBoxButton.OKCancel,
|
||||
MessageBoxImage.Warning)
|
||||
== MessageBoxResult.Cancel)
|
||||
|
|
@ -443,8 +443,8 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
case "IndexSearchExcludedPaths":
|
||||
if (SelectedIndexSearchExcludedPath == null) return;
|
||||
if (Context.API.ShowMsgBox(
|
||||
Context.API.GetTranslation("plugin_explorer_delete_index_search_excluded_path"),
|
||||
Context.API.GetTranslation("plugin_explorer_delete"),
|
||||
Localize.plugin_explorer_delete_index_search_excluded_path(),
|
||||
Localize.plugin_explorer_delete(),
|
||||
MessageBoxButton.OKCancel,
|
||||
MessageBoxImage.Warning)
|
||||
== MessageBoxResult.Cancel)
|
||||
|
|
@ -457,7 +457,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
|
||||
private void ShowUnselectedMessage()
|
||||
{
|
||||
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
|
||||
var warning = Localize.plugin_explorer_make_selection_warning();
|
||||
Context.API.ShowMsgBox(warning);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,11 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
|
||||
private string actionKeyword;
|
||||
private readonly IPublicAPI _api;
|
||||
private bool _keywordEnabled;
|
||||
|
||||
public ActionKeywordSetting(ActionKeywordModel selectedActionKeyword, IPublicAPI api)
|
||||
public ActionKeywordSetting(ActionKeywordModel selectedActionKeyword)
|
||||
{
|
||||
CurrentActionKeyword = selectedActionKeyword;
|
||||
_api = api;
|
||||
ActionKeyword = selectedActionKeyword.Keyword;
|
||||
KeywordEnabled = selectedActionKeyword.Enabled;
|
||||
|
||||
|
|
@ -60,14 +58,14 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
switch (CurrentActionKeyword.KeywordProperty, KeywordEnabled)
|
||||
{
|
||||
case (Settings.ActionKeyword.FileContentSearchActionKeyword, true):
|
||||
_api.ShowMsgBox(_api.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
|
||||
Main.Context.API.ShowMsgBox(Localize.plugin_explorer_globalActionKeywordInvalid());
|
||||
return;
|
||||
case (Settings.ActionKeyword.QuickAccessActionKeyword, true):
|
||||
_api.ShowMsgBox(_api.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid"));
|
||||
Main.Context.API.ShowMsgBox(Localize.plugin_explorer_quickaccess_globalActionKeywordInvalid());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!KeywordEnabled || !_api.ActionKeywordAssigned(ActionKeyword))
|
||||
if (!KeywordEnabled || !Main.Context.API.ActionKeywordAssigned(ActionKeyword))
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
|
|
@ -75,7 +73,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
|
||||
// The keyword is not valid, so show message
|
||||
_api.ShowMsgBox(_api.GetTranslation("newActionKeywordsHasBeenAssigned"));
|
||||
Main.Context.API.ShowMsgBox(Localize.plugin_explorer_new_action_keyword_assigned());
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public partial class PreviewPanel : UserControl
|
|||
public string FileName { get; }
|
||||
|
||||
[ObservableProperty]
|
||||
private string _fileSize = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
private string _fileSize = Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
|
||||
[ObservableProperty]
|
||||
private string _createdAt = "";
|
||||
|
|
@ -111,17 +111,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file size for {filePath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,17 +142,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file created date for {filePath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,17 +173,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file modified date for {filePath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,17 +205,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Operation timed out while calculating folder size for {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
// For parallel operations, AggregateException may be thrown if any of the tasks fail
|
||||
catch (AggregateException ae)
|
||||
|
|
@ -224,22 +224,22 @@ public partial class PreviewPanel : UserControl
|
|||
{
|
||||
case FileNotFoundException:
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
case UnauthorizedAccessException:
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
case OperationCanceledException:
|
||||
Main.Context.API.LogError(ClassName, $"Operation timed out while calculating folder size for {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
default:
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder size for {folderPath}", ae);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder size for {folderPath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -260,17 +260,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder created date for {folderPath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,17 +291,17 @@ public partial class PreviewPanel : UserControl
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder modified date for {folderPath}", e);
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
return Localize.plugin_explorer_plugin_tooltip_more_info_unknown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -311,21 +311,20 @@ public partial class PreviewPanel : UserControl
|
|||
var difference = now - fileDateTime;
|
||||
|
||||
if (difference.TotalDays < 1)
|
||||
return Main.Context.API.GetTranslation("Today");
|
||||
return Localize.Today();
|
||||
if (difference.TotalDays < 30)
|
||||
return string.Format(Main.Context.API.GetTranslation("DaysAgo"), (int)difference.TotalDays);
|
||||
return Localize.DaysAgo((int)difference.TotalDays);
|
||||
|
||||
var monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month;
|
||||
if (monthsDiff == 1)
|
||||
return Main.Context.API.GetTranslation("OneMonthAgo");
|
||||
return Localize.OneMonthAgo();
|
||||
if (monthsDiff < 12)
|
||||
return string.Format(Main.Context.API.GetTranslation("MonthsAgo"), monthsDiff);
|
||||
return Localize.MonthsAgo(monthsDiff);
|
||||
|
||||
var yearsDiff = now.Year - fileDateTime.Year;
|
||||
if (now.Month < fileDateTime.Month || (now.Month == fileDateTime.Month && now.Day < fileDateTime.Day))
|
||||
yearsDiff--;
|
||||
|
||||
return yearsDiff == 1 ? Main.Context.API.GetTranslation("OneYearAgo") :
|
||||
string.Format(Main.Context.API.GetTranslation("YearsAgo"), yearsDiff);
|
||||
return yearsDiff == 1 ? Localize.OneYearAgo(): Localize.YearsAgo(yearsDiff);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public partial class QuickAccessLinkSettings
|
|||
// Validate the input before proceeding
|
||||
if (string.IsNullOrEmpty(SelectedName) || string.IsNullOrEmpty(SelectedPath))
|
||||
{
|
||||
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_no_folder_selected");
|
||||
var warning = Localize.plugin_explorer_quick_access_link_no_folder_selected();
|
||||
Main.Context.API.ShowMsgBox(warning);
|
||||
return;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ public partial class QuickAccessLinkSettings
|
|||
x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase) &&
|
||||
x.Name.Equals(SelectedName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_path_already_exists");
|
||||
var warning = Localize.plugin_explorer_quick_access_link_path_already_exists();
|
||||
Main.Context.API.ShowMsgBox(warning);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue