From 90ad72ca30ca7e99e3e84c4cac4e507f91b47a4c Mon Sep 17 00:00:00 2001 From: 01Dri Date: Fri, 23 May 2025 16:33:47 -0300 Subject: [PATCH 01/11] Diff Time in Created At and LastModifiedAt --- .../Views/PreviewPanel.xaml.cs | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index aaf1efdc1..1981a8b0e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Globalization; using System.IO; using System.Runtime.CompilerServices; @@ -65,22 +66,22 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged if (Settings.ShowCreatedDateInPreviewPanel) { - CreatedAt = File - .GetCreationTime(filePath) - .ToString( - $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", - CultureInfo.CurrentCulture - ); + DateTime createdDate = File.GetCreationTime(filePath); + string formattedDate = createdDate.ToString( + $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", + CultureInfo.CurrentCulture + ); + CreatedAt = $"{GetDiffTimeString(createdDate)} - {formattedDate}"; } if (Settings.ShowModifiedDateInPreviewPanel) { - LastModifiedAt = File - .GetLastWriteTime(filePath) - .ToString( - $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", - CultureInfo.CurrentCulture - ); + DateTime lastModifiedDate = File.GetLastWriteTime(filePath); + string formattedDate = lastModifiedDate.ToString( + $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", + CultureInfo.CurrentCulture + ); + LastModifiedAt = $"{GetDiffTimeString(lastModifiedDate)} - {formattedDate}"; } _ = LoadImageAsync(); @@ -90,7 +91,27 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged { PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } + + private string GetDiffTimeString(DateTime fileDateTime) + { + DateTime now = DateTime.Now; + TimeSpan difference = now - fileDateTime; + if (difference.TotalDays < 1) + return "Today"; + if (difference.TotalDays < 30) + return $"{(int)difference.TotalDays} days ago"; + + int monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month; + if (monthsDiff < 12) + return monthsDiff == 1 ? "1 month ago" : $"{monthsDiff} months ago"; + + int yearsDiff = now.Year - fileDateTime.Year; + if (now.Month < fileDateTime.Month || (now.Month == fileDateTime.Month && now.Day < fileDateTime.Day)) + yearsDiff--; + + return yearsDiff == 1 ? "1 year ago" : $"{yearsDiff} years ago"; + } public event PropertyChangedEventHandler? PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) From 35e71c6f510256bdad0692919cdbfa1578d5ee87 Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sat, 24 May 2025 00:12:56 -0300 Subject: [PATCH 02/11] Relative Date checkbox --- .../Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 3 +++ .../Languages/pt-br.xaml | 5 +++-- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 3 +++ .../ViewModels/SettingsViewModel.cs | 12 ++++++++++++ .../Views/ExplorerSettings.xaml | 5 +++++ .../Views/PreviewPanel.xaml.cs | 11 ++++++++--- 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 79f8a5848..6680aacff 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -33,6 +33,7 @@ Size Date Created Date Modified + Relative Date Display File Info Date and time format Sort Option: @@ -125,6 +126,8 @@ 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/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml index 2754a5a99..59770a29d 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml @@ -29,8 +29,9 @@ Everything Setting Preview Panel Tamanho - Date Created - Date Modified + Data Criação + Data Modificação + Data Relativa Display File Info Date and time format Sort Option: diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 3d30bcf29..0a91c024c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -66,6 +66,9 @@ namespace Flow.Launcher.Plugin.Explorer public bool ShowCreatedDateInPreviewPanel { get; set; } = true; public bool ShowModifiedDateInPreviewPanel { get; set; } = true; + + public bool ShowRelativeDateInPreviewPanel { get; set; } = true; + public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd"; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index cf9ebd33f..baa2c6c28 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -169,6 +169,18 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels } } + public bool ShowRelativeDateInPreviewPanel + { + get => Settings.ShowRelativeDateInPreviewPanel; + set + { + Settings.ShowRelativeDateInPreviewPanel = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(ShowPreviewPanelDateTimeChoices)); + OnPropertyChanged(nameof(PreviewPanelDateTimeChoicesVisibility)); + } + } + public string PreviewPanelDateFormat { get => Settings.PreviewPanelDateFormat; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index e5999da41..c16dc4f51 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -505,6 +505,11 @@ Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}" Content="{DynamicResource plugin_explorer_previewpanel_display_file_modification_checkbox}" IsChecked="{Binding ShowModifiedDateInPreviewPanel}" /> + + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 1981a8b0e..aa5ba6cc7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -71,7 +71,10 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", CultureInfo.CurrentCulture ); - CreatedAt = $"{GetDiffTimeString(createdDate)} - {formattedDate}"; + + string result = formattedDate; + if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetFileAge(createdDate)} - {formattedDate}"; + CreatedAt = result; } if (Settings.ShowModifiedDateInPreviewPanel) @@ -81,7 +84,9 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged $"{Settings.PreviewPanelDateFormat} {Settings.PreviewPanelTimeFormat}", CultureInfo.CurrentCulture ); - LastModifiedAt = $"{GetDiffTimeString(lastModifiedDate)} - {formattedDate}"; + string result = formattedDate; + if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetFileAge(lastModifiedDate)} - {formattedDate}"; + LastModifiedAt = result; } _ = LoadImageAsync(); @@ -92,7 +97,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } - private string GetDiffTimeString(DateTime fileDateTime) + private string GetFileAge(DateTime fileDateTime) { DateTime now = DateTime.Now; TimeSpan difference = now - fileDateTime; From 02ddcaa0642a123ee1ac7caf747783651d4fc2f5 Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sat, 24 May 2025 00:15:08 -0300 Subject: [PATCH 03/11] Function name changed to GetRelativeDate --- .../Views/PreviewPanel.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index aa5ba6cc7..05dfd66f3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -73,7 +73,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged ); string result = formattedDate; - if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetFileAge(createdDate)} - {formattedDate}"; + if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetRelativeDate(createdDate)} - {formattedDate}"; CreatedAt = result; } @@ -85,7 +85,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged CultureInfo.CurrentCulture ); string result = formattedDate; - if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetFileAge(lastModifiedDate)} - {formattedDate}"; + if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetRelativeDate(lastModifiedDate)} - {formattedDate}"; LastModifiedAt = result; } @@ -97,7 +97,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } - private string GetFileAge(DateTime fileDateTime) + private string GetRelativeDate(DateTime fileDateTime) { DateTime now = DateTime.Now; TimeSpan difference = now - fileDateTime; From a711ce4ec793158c6586ec70e5e0cd913c77319b Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sat, 24 May 2025 01:10:12 -0300 Subject: [PATCH 04/11] Translate pt br --- Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml index 59770a29d..3ab958506 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml @@ -29,8 +29,8 @@ Everything Setting Preview Panel Tamanho - Data Criação - Data Modificação + Data de Criação + Data de Modificação Data Relativa Display File Info Date and time format From f6103b1105d9c741c87ed0f954622c271a87620a Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sat, 24 May 2025 03:16:03 -0300 Subject: [PATCH 05/11] Relative Date -> File Age --- Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 2 +- Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml | 2 +- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 2 +- .../ViewModels/SettingsViewModel.cs | 6 +++--- .../Views/ExplorerSettings.xaml | 4 ++-- .../Views/PreviewPanel.xaml.cs | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 6680aacff..aa86d96cf 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -33,7 +33,7 @@ Size Date Created Date Modified - Relative Date + File Age Display File Info Date and time format Sort Option: diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml index 3ab958506..ca7d9b48e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml @@ -31,7 +31,7 @@ Tamanho Data de Criação Data de Modificação - Data Relativa + Idade do Arquivo Display File Info Date and time format Sort Option: diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 0a91c024c..158cf0347 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.Explorer public bool ShowModifiedDateInPreviewPanel { get; set; } = true; - public bool ShowRelativeDateInPreviewPanel { get; set; } = true; + public bool ShowFileAgeInPreviewPanel { get; set; } = true; public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd"; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index baa2c6c28..fb33dacab 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -169,12 +169,12 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels } } - public bool ShowRelativeDateInPreviewPanel + public bool ShowFileAgeInPreviewPanel { - get => Settings.ShowRelativeDateInPreviewPanel; + get => Settings.ShowFileAgeInPreviewPanel; set { - Settings.ShowRelativeDateInPreviewPanel = value; + Settings.ShowFileAgeInPreviewPanel = value; OnPropertyChanged(); OnPropertyChanged(nameof(ShowPreviewPanelDateTimeChoices)); OnPropertyChanged(nameof(PreviewPanelDateTimeChoicesVisibility)); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index c16dc4f51..4302e721a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -508,8 +508,8 @@ + Content="{DynamicResource plugin_explorer_previewpanel_display_file_age_checkbox}" + IsChecked="{Binding ShowFileAgeInPreviewPanel}" /> diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 05dfd66f3..801510eb7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -73,7 +73,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged ); string result = formattedDate; - if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetRelativeDate(createdDate)} - {formattedDate}"; + if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetRelativeDate(createdDate)} - {formattedDate}"; CreatedAt = result; } @@ -85,7 +85,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged CultureInfo.CurrentCulture ); string result = formattedDate; - if (Settings.ShowRelativeDateInPreviewPanel) result = $"{GetRelativeDate(lastModifiedDate)} - {formattedDate}"; + if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetRelativeDate(lastModifiedDate)} - {formattedDate}"; LastModifiedAt = result; } From d726455b047c380179243ff85ee132e7d601ba0c Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sat, 24 May 2025 03:16:51 -0300 Subject: [PATCH 06/11] Relative Date - FileAge --- .../Views/PreviewPanel.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 801510eb7..28ceb5e96 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -73,7 +73,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged ); string result = formattedDate; - if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetRelativeDate(createdDate)} - {formattedDate}"; + if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetFileAge(createdDate)} - {formattedDate}"; CreatedAt = result; } @@ -85,7 +85,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged CultureInfo.CurrentCulture ); string result = formattedDate; - if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetRelativeDate(lastModifiedDate)} - {formattedDate}"; + if (Settings.ShowFileAgeInPreviewPanel) result = $"{GetFileAge(lastModifiedDate)} - {formattedDate}"; LastModifiedAt = result; } @@ -97,7 +97,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } - private string GetRelativeDate(DateTime fileDateTime) + private string GetFileAge(DateTime fileDateTime) { DateTime now = DateTime.Now; TimeSpan difference = now - fileDateTime; From 2ff0fc8a7d8de2306229f8439b530932974f4519 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 24 May 2025 15:28:51 +0900 Subject: [PATCH 07/11] Disable ShowFileAgeInPreviewPanel by default --- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 158cf0347..49ad2d358 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.Explorer public bool ShowModifiedDateInPreviewPanel { get; set; } = true; - public bool ShowFileAgeInPreviewPanel { get; set; } = true; + public bool ShowFileAgeInPreviewPanel { get; set; } = false; public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd"; From 03d3c9292dcfc3814a890b9e0806e975f3abff59 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 24 May 2025 15:55:37 +0800 Subject: [PATCH 08/11] Fix blnak lie --- Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 2 -- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index aa86d96cf..ca994455a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -126,8 +126,6 @@ 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/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 49ad2d358..4f83fc72e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -27,7 +27,6 @@ namespace Flow.Launcher.Plugin.Explorer public string ExcludedFileTypes { get; set; } = ""; - public bool UseLocationAsWorkingDir { get; set; } = false; public bool ShowInlinedWindowsContextMenu { get; set; } = false; From 65e0a0220b07bf58ff6ffed2a796ea1094a66b5c Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 24 May 2025 15:56:02 +0800 Subject: [PATCH 09/11] Revert changes in pt-br.xaml --- Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml index ca7d9b48e..2754a5a99 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml @@ -29,9 +29,8 @@ Everything Setting Preview Panel Tamanho - Data de Criação - Data de Modificação - Idade do Arquivo + Date Created + Date Modified Display File Info Date and time format Sort Option: From 0f718e5d920bab13a285f42b4fb9ac83c759a9af Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 24 May 2025 15:59:24 +0800 Subject: [PATCH 10/11] Code quality --- .../Views/PreviewPanel.xaml.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 28ceb5e96..eabe1ad41 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -97,26 +97,27 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } - private string GetFileAge(DateTime fileDateTime) + private static string GetFileAge(DateTime fileDateTime) { - DateTime now = DateTime.Now; - TimeSpan difference = now - fileDateTime; + var now = DateTime.Now; + var difference = now - fileDateTime; if (difference.TotalDays < 1) return "Today"; if (difference.TotalDays < 30) return $"{(int)difference.TotalDays} days ago"; - int monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month; + var monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month; if (monthsDiff < 12) return monthsDiff == 1 ? "1 month ago" : $"{monthsDiff} months ago"; - int yearsDiff = now.Year - fileDateTime.Year; + var yearsDiff = now.Year - fileDateTime.Year; if (now.Month < fileDateTime.Month || (now.Month == fileDateTime.Month && now.Day < fileDateTime.Day)) yearsDiff--; return yearsDiff == 1 ? "1 year ago" : $"{yearsDiff} years ago"; } + public event PropertyChangedEventHandler? PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) From 62d7256db43d03eb56084fe82e21641ef8fa1ceb Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 24 May 2025 16:07:15 +0800 Subject: [PATCH 11/11] Support transaltion for preview information --- .../Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 8 ++++++++ .../Views/PreviewPanel.xaml.cs | 11 +++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index ca994455a..eefd6f4eb 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -167,4 +167,12 @@ Display native context menu (experimental) Below you can specify items you want to include in the context menu, they can be partial (e.g. 'pen wit') or complete ('Open with'). Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with'). + + + Today + {0} days ago + 1 month ago + {0} months ago + 1 year ago + {0} years ago diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index eabe1ad41..e1a957199 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -103,19 +103,22 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged var difference = now - fileDateTime; if (difference.TotalDays < 1) - return "Today"; + return Main.Context.API.GetTranslation("Today"); if (difference.TotalDays < 30) - return $"{(int)difference.TotalDays} days ago"; + return string.Format(Main.Context.API.GetTranslation("DaysAgo"), (int)difference.TotalDays); var monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month; + if (monthsDiff == 1) + return Main.Context.API.GetTranslation("OneMonthAgo"); if (monthsDiff < 12) - return monthsDiff == 1 ? "1 month ago" : $"{monthsDiff} months ago"; + return string.Format(Main.Context.API.GetTranslation("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 ? "1 year ago" : $"{yearsDiff} years ago"; + return yearsDiff == 1 ? Main.Context.API.GetTranslation("OneYearAgo") : + string.Format(Main.Context.API.GetTranslation("YearsAgo"), yearsDiff); } public event PropertyChangedEventHandler? PropertyChanged;