diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj index 9cb2469d9d7..e3233f73d2e 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -104,7 +104,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj index b3cee425d4e..20a0ec4f06c 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj @@ -63,7 +63,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index 3802c701b27..90db8796605 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -66,8 +66,8 @@ public List LoadContextMenus(Result selectedResult) { 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) { 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) _ = 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 @@ public List LoadContextMenus(Result selectedResult) { 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ public List LoadContextMenus(Result selectedResult) 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 @@ private Result CreateOpenContainingFolderResult(SearchResult record) { 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 @@ private Result CreateOpenContainingFolderResult(SearchResult record) 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 @@ private Result CreateOpenContainingFolderResult(SearchResult record) }; } - - 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 @@ private Result CreateOpenWithEditorResult(SearchResult record, string editorPath } 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 @@ private Result CreateOpenWithShellResult(SearchResult record) { 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 @@ private Result CreateOpenWithShellResult(SearchResult record) } 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 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record) { 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 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record) _ = 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 @@ private Result CreateOpenWindowsIndexingOptions() { 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 @@ private Result CreateOpenWindowsIndexingOptions() } 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 @@ private Result CreateOpenWindowsIndexingOptions() }; } - 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}"); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj index b7c54e57847..a837a49b49b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -48,7 +48,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 16ef037ccfd..c40040df5be 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -24,6 +24,7 @@ Error occurred during search: {0} Could not open folder Could not open file + This new action keyword is already assigned to another plugin, please choose a different one Delete diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs index d93c6c77b9f..f5b8b932581 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs @@ -90,12 +90,12 @@ public async Task> QueryAsync(Query query, CancellationToken token) 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) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs index c8bd68279f2..13d988f1ad0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs @@ -21,9 +21,9 @@ public static async Task PromptDownloadIfNotInstallAsync(string installe 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 async Task PromptDownloadIfNotInstallAsync(string installe 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 @@ internal static string GetInstalledPath() var scoopInstalledPath = Environment.ExpandEnvironmentVariables(@"%userprofile%\scoop\apps\everything\current\Everything.exe"); return File.Exists(scoopInstalledPath) ? scoopInstalledPath : string.Empty; - } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs index ce71c94ba34..eb994a6f98f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs @@ -27,8 +27,8 @@ private async ValueTask ThrowIfEverythingNotAvailableAsync(CancellationToken tok 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 @@ private async ValueTask ThrowIfEverythingNotAvailableAsync(CancellationToken tok 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 @@ private async ValueTask ClickToInstallEverythingAsync(ActionContext _) 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 @@ private async ValueTask ClickToInstallEverythingAsync(ActionContext _) // 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 @@ public async IAsyncEnumerable ContentSearchAsync(string plainSearc 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, _ => { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index dfa2c8d43d0..18eb168b9bd 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -124,7 +124,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string } 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 @@ internal static Result CreateFolderResult(string title, string subtitle, string } 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 @@ internal static Result CreateFolderResult(string title, string subtitle, string } 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 @@ internal static Result CreateFolderResult(string title, string subtitle, string 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 @@ private static Result CreateDriveSpaceDisplayResult(string path, string actionKe 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 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK 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 @@ internal static Result CreateFileResult(string filePath, Query query, int score } 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 @@ private static string GetFileMoreInfoTooltip(string filePath) 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 @@ private static string GetFolderMoreInfoTooltip(string folderPath) 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 @@ private static string GetFolderMoreInfoTooltip(string folderPath) 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 = diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index f4f87d4d4be..f9d8963e6a9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -161,8 +161,8 @@ private List EverythingContentSearchResult(Query query) { 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 => { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs index 3d69a1ee672..eeb5c2c4aaf 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs @@ -105,8 +105,8 @@ private IAsyncEnumerable HandledEngineNotAvailableExceptionAsync() 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 => { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 672e81d0386..8d62531cd62 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -14,9 +14,9 @@ public class Settings { public int MaxResult { get; set; } = 100; - public ObservableCollection QuickAccessLinks { get; set; } = new(); + public ObservableCollection QuickAccessLinks { get; set; } = []; - public ObservableCollection IndexSearchExcludedSubdirectoryPaths { get; set; } = new ObservableCollection(); + public ObservableCollection IndexSearchExcludedSubdirectoryPaths { get; set; } = []; public string EditorPath { get; set; } = ""; @@ -58,7 +58,6 @@ public class Settings public bool QuickAccessKeywordEnabled { get; set; } - public bool WarnWindowsSearchServiceOff { get; set; } = true; public bool ShowFileSizeInPreviewPanel { get; set; } = true; @@ -69,7 +68,6 @@ public class Settings 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 @@ public class Settings 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 @@ public enum ContentIndexSearchEngineOption #endregion - #region Everything Settings public string EverythingInstalledPath { get; set; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index ae2235c5cf9..2d46c6307cc 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -296,7 +296,7 @@ private void EditActionKeyword(object obj) return; } - var actionKeywordWindow = new ActionKeywordSetting(actionKeyword, Context.API); + var actionKeywordWindow = new ActionKeywordSetting(actionKeyword); if (!(actionKeywordWindow.ShowDialog() ?? false)) { @@ -432,8 +432,8 @@ private void RemoveLink(object commandParameter) 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 @@ private void RemoveLink(object commandParameter) 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 @@ private void RemoveLink(object commandParameter) 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); } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 829a2feedd3..562170062b0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -29,13 +29,11 @@ public bool KeywordEnabled } 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 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e) 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 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e) } // 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) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 4dd0588ee60..3c627cc069b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -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 static string GetFileSize(string filePath) 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 static string GetFileCreatedAt(string filePath, string previewPanelDateFo 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 static string GetFileLastModifiedAt(string filePath, string previewPanelD 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 static string GetFolderSize(string folderPath) 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 static string GetFolderSize(string folderPath) { 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 static string GetFolderCreatedAt(string folderPath, string previewPanelDa 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 static string GetFolderLastModifiedAt(string folderPath, string previewPa 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 @@ private static string GetFileAge(DateTime fileDateTime) 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); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index e6294b98b65..f8929549b4b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -97,7 +97,7 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e) // 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 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e) 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; }