localization: add translations for commit time period

This commit is contained in:
leo 2024-07-16 14:06:02 +08:00
parent 80a7b73dd4
commit 72ca571c00
No known key found for this signature in database
4 changed files with 35 additions and 8 deletions

View file

@ -341,6 +341,15 @@
<x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">Copy Repository Path</x:String> <x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">Copy Repository Path</x:String>
<x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">Repositories</x:String> <x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">Repositories</x:String>
<x:String x:Key="Text.Paste" xml:space="preserve">Paste</x:String> <x:String x:Key="Text.Paste" xml:space="preserve">Paste</x:String>
<x:String x:Key="Text.Period.JustNow" xml:space="preserve">Just now</x:String>
<x:String x:Key="Text.Period.MinutesAgo" xml:space="preserve">{0} minutes ago</x:String>
<x:String x:Key="Text.Period.HoursAgo" xml:space="preserve">{0} hours ago</x:String>
<x:String x:Key="Text.Period.Yesterday" xml:space="preserve">Yesterday</x:String>
<x:String x:Key="Text.Period.DaysAgo" xml:space="preserve">{0} days ago</x:String>
<x:String x:Key="Text.Period.LastMonth" xml:space="preserve">Last month</x:String>
<x:String x:Key="Text.Period.MonthsAgo" xml:space="preserve">{0} months ago</x:String>
<x:String x:Key="Text.Period.LastYear" xml:space="preserve">Last year</x:String>
<x:String x:Key="Text.Period.YearsAgo" xml:space="preserve">{0} years ago</x:String>
<x:String x:Key="Text.Preference" xml:space="preserve">Preference</x:String> <x:String x:Key="Text.Preference" xml:space="preserve">Preference</x:String>
<x:String x:Key="Text.Preference.Appearance" xml:space="preserve">APPEARANCE</x:String> <x:String x:Key="Text.Preference.Appearance" xml:space="preserve">APPEARANCE</x:String>
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String> <x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>

View file

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="en_US.axaml"/> <ResourceInclude Source="avares://SourceGit/Resources/Locales/en_US.axaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<x:String x:Key="Text.About" xml:space="preserve">关于软件</x:String> <x:String x:Key="Text.About" xml:space="preserve">关于软件</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">关于本软件</x:String> <x:String x:Key="Text.About.Menu" xml:space="preserve">关于本软件</x:String>
@ -344,6 +344,15 @@
<x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">复制仓库路径</x:String> <x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">复制仓库路径</x:String>
<x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">新标签页</x:String> <x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">新标签页</x:String>
<x:String x:Key="Text.Paste" xml:space="preserve">粘贴</x:String> <x:String x:Key="Text.Paste" xml:space="preserve">粘贴</x:String>
<x:String x:Key="Text.Period.JustNow" xml:space="preserve">刚刚</x:String>
<x:String x:Key="Text.Period.MinutesAgo" xml:space="preserve">{0}分钟前</x:String>
<x:String x:Key="Text.Period.HoursAgo" xml:space="preserve">{0}小时前</x:String>
<x:String x:Key="Text.Period.Yesterday" xml:space="preserve">昨天</x:String>
<x:String x:Key="Text.Period.DaysAgo" xml:space="preserve">{0}天前</x:String>
<x:String x:Key="Text.Period.LastMonth" xml:space="preserve">上个月</x:String>
<x:String x:Key="Text.Period.MonthsAgo" xml:space="preserve">{0}个月前</x:String>
<x:String x:Key="Text.Period.LastYear" xml:space="preserve">一年前</x:String>
<x:String x:Key="Text.Period.YearsAgo" xml:space="preserve">{0}年前</x:String>
<x:String x:Key="Text.Preference" xml:space="preserve">偏好设置</x:String> <x:String x:Key="Text.Preference" xml:space="preserve">偏好设置</x:String>
<x:String x:Key="Text.Preference.Appearance" xml:space="preserve">外观配置</x:String> <x:String x:Key="Text.Preference.Appearance" xml:space="preserve">外观配置</x:String>
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String> <x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String>

View file

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="en_US.axaml"/> <ResourceInclude Source="avares://SourceGit/Resources/Locales/en_US.axaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<x:String x:Key="Text.About" xml:space="preserve">關於軟體</x:String> <x:String x:Key="Text.About" xml:space="preserve">關於軟體</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">關於本軟體</x:String> <x:String x:Key="Text.About.Menu" xml:space="preserve">關於本軟體</x:String>
@ -344,6 +344,15 @@
<x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">複製倉庫路徑</x:String> <x:String x:Key="Text.PageTabBar.Tab.CopyPath" xml:space="preserve">複製倉庫路徑</x:String>
<x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">新標籤頁</x:String> <x:String x:Key="Text.PageTabBar.Welcome.Title" xml:space="preserve">新標籤頁</x:String>
<x:String x:Key="Text.Paste" xml:space="preserve">貼上</x:String> <x:String x:Key="Text.Paste" xml:space="preserve">貼上</x:String>
<x:String x:Key="Text.Period.JustNow" xml:space="preserve">剛剛</x:String>
<x:String x:Key="Text.Period.MinutesAgo" xml:space="preserve">{0}分鐘前</x:String>
<x:String x:Key="Text.Period.HoursAgo" xml:space="preserve">{0}小時前</x:String>
<x:String x:Key="Text.Period.Yesterday" xml:space="preserve">昨天</x:String>
<x:String x:Key="Text.Period.DaysAgo" xml:space="preserve">{0}天前</x:String>
<x:String x:Key="Text.Period.LastMonth" xml:space="preserve">上個月</x:String>
<x:String x:Key="Text.Period.MonthsAgo" xml:space="preserve">{0}個月前</x:String>
<x:String x:Key="Text.Period.LastYear" xml:space="preserve">一年前</x:String>
<x:String x:Key="Text.Period.YearsAgo" xml:space="preserve">{0}年前</x:String>
<x:String x:Key="Text.Preference" xml:space="preserve">偏好設定</x:String> <x:String x:Key="Text.Preference" xml:space="preserve">偏好設定</x:String>
<x:String x:Key="Text.Preference.Appearance" xml:space="preserve">外觀配置</x:String> <x:String x:Key="Text.Preference.Appearance" xml:space="preserve">外觀配置</x:String>
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String> <x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String>

View file

@ -139,7 +139,7 @@ namespace SourceGit.Views
}); });
return true; return true;
}, TimeSpan.FromSeconds(4)); }, TimeSpan.FromSeconds(10));
} }
private void StopTimer() private void StopTimer()
@ -164,9 +164,9 @@ namespace SourceGit.Views
var now = DateTime.Now; var now = DateTime.Now;
var timespan = now - committerTime; var timespan = now - committerTime;
if (timespan.TotalHours > 1) if (timespan.TotalHours > 1)
return $"{(int)timespan.TotalHours} hours ago"; return App.Text("Period.HoursAgo", (int)timespan.TotalHours);
return timespan.TotalMinutes < 1 ? "Just now" : $"{(int)timespan.TotalMinutes} minutes ago"; return timespan.TotalMinutes < 1 ? App.Text("Period.JustNow") : App.Text("Period.MinutesAgo", (int)timespan.TotalMinutes);
} }
var diffYear = today.Year - committerTime.Year; var diffYear = today.Year - committerTime.Year;
@ -174,13 +174,13 @@ namespace SourceGit.Views
{ {
var diffMonth = today.Month - committerTime.Month; var diffMonth = today.Month - committerTime.Month;
if (diffMonth > 0) if (diffMonth > 0)
return diffMonth == 1 ? "Last month" : $"{diffMonth} months ago"; return diffMonth == 1 ? App.Text("Period.LastMonth") : App.Text("Period.MonthsAgo", diffMonth);
var diffDay = today.Day - committerTime.Day; var diffDay = today.Day - committerTime.Day;
return diffDay == 1 ? "Yesterday" : $"{diffDay} days ago"; return diffDay == 1 ? App.Text("Period.Yesterday") : App.Text("Period.DaysAgo", diffDay);
} }
return diffYear == 1 ? "Last year" : $"{diffYear} years ago"; return diffYear == 1 ? App.Text("Period.LastYear") : App.Text("Period.YearsAgo", diffYear);
} }
private IDisposable _refreshTimer = null; private IDisposable _refreshTimer = null;