mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Support transaltion for preview information
This commit is contained in:
parent
0f718e5d92
commit
62d7256db4
2 changed files with 15 additions and 4 deletions
|
|
@ -167,4 +167,12 @@
|
|||
<system:String x:Key="plugin_explorer_native_context_menu_display_context_menu">Display native context menu (experimental)</system:String>
|
||||
<system:String x:Key="plugin_explorer_native_context_menu_include_patterns_guide">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').</system:String>
|
||||
<system:String x:Key="plugin_explorer_native_context_menu_exclude_patterns_guide">Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with').</system:String>
|
||||
|
||||
<!-- Preview Info -->
|
||||
<system:String x:Key="Today">Today</system:String>
|
||||
<system:String x:Key="DaysAgo">{0} days ago</system:String>
|
||||
<system:String x:Key="OneMonthAgo">1 month ago</system:String>
|
||||
<system:String x:Key="MonthsAgo">{0} months ago</system:String>
|
||||
<system:String x:Key="OneYearAgo">1 year ago</system:String>
|
||||
<system:String x:Key="YearsAgo">{0} years ago</system:String>
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue