From 3bb20868fcc978814656baa663b8fa4c9caf0ab4 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 6 Jun 2025 10:45:18 +0800 Subject: [PATCH] refactor: remove unnecessary sort by name (descending) for tags (#1393) Signed-off-by: leo --- src/Models/Tag.cs | 3 +-- src/Resources/Locales/de_DE.axaml | 3 +-- src/Resources/Locales/en_US.axaml | 3 +-- src/Resources/Locales/es_ES.axaml | 3 +-- src/Resources/Locales/fr_FR.axaml | 3 +-- src/Resources/Locales/it_IT.axaml | 3 +-- src/Resources/Locales/ja_JP.axaml | 2 +- src/Resources/Locales/ru_RU.axaml | 3 +-- src/Resources/Locales/ta_IN.axaml | 3 +-- src/Resources/Locales/uk_UA.axaml | 3 +-- src/Resources/Locales/zh_CN.axaml | 3 +-- src/Resources/Locales/zh_TW.axaml | 3 +-- src/ViewModels/Repository.cs | 30 ++++++++---------------------- 13 files changed, 20 insertions(+), 45 deletions(-) diff --git a/src/Models/Tag.cs b/src/Models/Tag.cs index 20678530..87944637 100644 --- a/src/Models/Tag.cs +++ b/src/Models/Tag.cs @@ -5,8 +5,7 @@ namespace SourceGit.Models public enum TagSortMode { CreatorDate = 0, - NameInAscending, - NameInDescending, + Name, } public class Tag : ObservableObject diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index b7874216..89a0ae1b 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -624,8 +624,7 @@ TAGS NEUER TAG Nach Erstellungsdatum - Nach Namen (Aufsteigend) - Nach Namen (Absteigend) + Nach Namen Sortiere Öffne im Terminal Verwende relative Zeitangaben in Verlauf diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 765b6f8c..8ed2770d 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -638,8 +638,7 @@ TAGS New Tag By Creator Date - By Name (Ascending) - By Name (Descending) + By Name Sort Open in Terminal Use relative time in histories diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index c1687f9c..a1879bde 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -641,8 +641,7 @@ ETIQUETAS NUEVA ETIQUETA Por Fecha de Creación - Por Nombre (Ascendiente) - Por Nombre (Descendiente) + Por Nombre Ordenar Abrir en Terminal Usar tiempo relativo en las historias diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 24dd365e..52ec8d6d 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -602,8 +602,7 @@ TAGS NOUVEAU TAG Par date de créateur - Par nom (Croissant) - Par nom (Décroissant) + Par nom Trier Ouvrir dans un terminal Utiliser le temps relatif dans les historiques diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 1484201c..9488d8d9 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -628,8 +628,7 @@ TAG NUOVO TAG Per data di creazione - Per nome (ascendente) - Per nome (discendente) + Per nome Ordina Apri nel Terminale Usa tempo relativo nello storico diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml index db395d86..80372cb4 100644 --- a/src/Resources/Locales/ja_JP.axaml +++ b/src/Resources/Locales/ja_JP.axaml @@ -600,7 +600,7 @@ タグ 新しいタグを作成 作成者日時 - 名前 (昇順) + 名前 ソート ターミナルで開く 履歴に相対時間を使用 diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 537a3deb..0aeb60b5 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -639,8 +639,7 @@ МЕТКИ НОВАЯ МЕТКА По дате создания - По имени (по возрастанию) - По имени (по убыванию) + По имени Сортировать Открыть в терминале Использовать относительное время в историях diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml index 7f3542c3..ec558c5d 100644 --- a/src/Resources/Locales/ta_IN.axaml +++ b/src/Resources/Locales/ta_IN.axaml @@ -601,8 +601,7 @@ குறிசொற்கள் புதிய குறிசொல் படைப்பாளர் தேதியின்படி - பெயர் (ஏறுவரிசை) மூலம் - பெயர் (இறகுவரிசை) மூலம் + பெயர் மூலம் வரிசைப்படுத்து முனையத்தில் திற வரலாறுகளில் உறவு நேரத்தைப் பயன்படுத்து diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml index 62842054..714374ce 100644 --- a/src/Resources/Locales/uk_UA.axaml +++ b/src/Resources/Locales/uk_UA.axaml @@ -606,8 +606,7 @@ ТЕГИ НОВИЙ ТЕГ За датою створення - За назвою (за зростанням) - За назвою (за спаданням) + За назвою Сортувати Відкрити в терміналі Використовувати відносний час в історії diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index c2a44bbf..628a097a 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -642,8 +642,7 @@ 标签列表 新建标签 按创建时间 - 按名称(升序) - 按名称(降序) + 按名称 排序 在终端中打开 在提交列表中使用相对时间 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index a4e6074b..e2261005 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -642,8 +642,7 @@ 標籤列表 新增標籤 依建立時間 - 依名稱升序 - 依名稱降序 + 依名稱 排序 在終端機中開啟 在提交列表中使用相對時間 diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 2b2771ec..3dbe8cfc 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -2442,30 +2442,19 @@ namespace SourceGit.ViewModels ev.Handled = true; }; - var byNameAsc = new MenuItem(); - byNameAsc.Header = App.Text("Repository.Tags.OrderByNameAsc"); - if (mode == Models.TagSortMode.NameInAscending) - byNameAsc.Icon = App.CreateMenuIcon("Icons.Check"); - byNameAsc.Click += (_, ev) => + var byName = new MenuItem(); + byName.Header = App.Text("Repository.Tags.OrderByName"); + if (mode == Models.TagSortMode.Name) + byName.Icon = App.CreateMenuIcon("Icons.Check"); + byName.Click += (_, ev) => { - changeMode(Models.TagSortMode.NameInAscending); - ev.Handled = true; - }; - - var byNameDes = new MenuItem(); - byNameDes.Header = App.Text("Repository.Tags.OrderByNameDes"); - if (mode == Models.TagSortMode.NameInDescending) - byNameDes.Icon = App.CreateMenuIcon("Icons.Check"); - byNameDes.Click += (_, ev) => - { - changeMode(Models.TagSortMode.NameInDescending); + changeMode(Models.TagSortMode.Name); ev.Handled = true; }; var menu = new ContextMenu(); menu.Items.Add(byCreatorDate); - menu.Items.Add(byNameAsc); - menu.Items.Add(byNameDes); + menu.Items.Add(byName); return menu; } @@ -2638,11 +2627,8 @@ namespace SourceGit.ViewModels case Models.TagSortMode.CreatorDate: _tags.Sort((l, r) => r.CreatorDate.CompareTo(l.CreatorDate)); break; - case Models.TagSortMode.NameInAscending: - _tags.Sort((l, r) => Models.NumericSort.Compare(l.Name, r.Name)); - break; default: - _tags.Sort((l, r) => Models.NumericSort.Compare(r.Name, l.Name)); + _tags.Sort((l, r) => Models.NumericSort.Compare(l.Name, r.Name)); break; }