From 61c52cc888dafa8f8b9117b5108a2e3a4c322d09 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 23 Feb 2026 23:25:44 +0800 Subject: [PATCH] fix incorrect display name of sort type in the insight explorer --- src/core/base.ts | 4 ++++ src/core/statistics.ts | 16 +++++++-------- src/locales/de.json | 4 +--- src/locales/en.json | 4 +--- src/locales/es.json | 4 +--- src/locales/fr.json | 4 +--- src/locales/helpers.ts | 20 +++++++++++++++---- src/locales/it.json | 4 +--- src/locales/ja.json | 4 +--- src/locales/kn.json | 4 +--- src/locales/ko.json | 4 +--- src/locales/nl.json | 4 +--- src/locales/pt_BR.json | 4 +--- src/locales/ru.json | 4 +--- src/locales/sl.json | 4 +--- src/locales/ta.json | 4 +--- src/locales/th.json | 4 +--- src/locales/tr.json | 4 +--- src/locales/uk.json | 4 +--- src/locales/vi.json | 4 +--- src/locales/zh_Hans.json | 4 +--- src/locales/zh_Hant.json | 4 +--- .../insights/tabs/ExplorerChartTab.vue | 2 +- 23 files changed, 48 insertions(+), 70 deletions(-) diff --git a/src/core/base.ts b/src/core/base.ts index 5df1a301..a93173a5 100644 --- a/src/core/base.ts +++ b/src/core/base.ts @@ -85,6 +85,10 @@ export interface TypeAndName { readonly name: string; } +export interface TypeAndNameWithAlternativeName extends TypeAndName { + readonly alternativeName?: string; +} + export interface TypeAndDisplayName { readonly type: number; readonly displayName: string; diff --git a/src/core/statistics.ts b/src/core/statistics.ts index dd98418a..494375c0 100644 --- a/src/core/statistics.ts +++ b/src/core/statistics.ts @@ -1,4 +1,4 @@ -import type { TypeAndName } from './base.ts'; +import type { TypeAndName, TypeAndNameWithAlternativeName } from './base.ts'; import { DateRange } from '@/core/datetime.ts'; export enum StatisticsAnalysisType { @@ -193,24 +193,24 @@ export class ChartDataType implements TypeAndName { } } -export class ChartSortingType implements TypeAndName { +export class ChartSortingType implements TypeAndNameWithAlternativeName { private static readonly allInstances: ChartSortingType[] = []; private static readonly allInstancesByType: Record = {}; - public static readonly Amount = new ChartSortingType(0, 'Amount', 'Sort by Amount'); - public static readonly DisplayOrder = new ChartSortingType(1, 'Display Order', 'Sort by Display Order'); - public static readonly Name = new ChartSortingType(2, 'Name', 'Sort by Name'); + public static readonly Amount = new ChartSortingType(0, 'Amount', 'Value'); + public static readonly DisplayOrder = new ChartSortingType(1, 'Display Order'); + public static readonly Name = new ChartSortingType(2, 'Name'); public static readonly Default = ChartSortingType.Amount; public readonly type: number; public readonly name: string; - public readonly fullName: string; + public readonly alternativeName?: string; - private constructor(type: number, name: string, fullName: string) { + private constructor(type: number, name: string, alternativeName?: string) { this.type = type; this.name = name; - this.fullName = fullName; + this.alternativeName = alternativeName; ChartSortingType.allInstances.push(this); ChartSortingType.allInstancesByType[type] = this; diff --git a/src/locales/de.json b/src/locales/de.json index cbdbb91e..0c9d8e0c 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Höchstbetrag", "Display Order": "Anzeigereihenfolge", "Name": "Name", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Nach Betrag sortieren", - "Sort by Display Order": "Nach Anzeigereihenfolge sortieren", - "Sort by Name": "Nach Name sortieren", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Nach Monat aggregieren", diff --git a/src/locales/en.json b/src/locales/en.json index 5799e5e5..13b4fd2b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Maximum Amount", "Display Order": "Display Order", "Name": "Name", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Sort by Amount", - "Sort by Display Order": "Sort by Display Order", - "Sort by Name": "Sort by Name", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Aggregate by Month", diff --git a/src/locales/es.json b/src/locales/es.json index 5c55fbfe..94da9e96 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Importe Máximo", "Display Order": "Orden de Visualización", "Name": "Nombre", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Ordenar por Importe", - "Sort by Display Order": "Ordenar por Orden de Visualización", - "Sort by Name": "Ordenar por Nombre", "Time Granularity": "Granularidad Temporal", "Aggregate by Day": "Agregado por Día", "Aggregate by Month": "Agregado por Mes", diff --git a/src/locales/fr.json b/src/locales/fr.json index c3e1545e..27e35403 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Montant maximum", "Display Order": "Ordre d'affichage", "Name": "Nom", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Trier par montant", - "Sort by Display Order": "Trier par ordre d'affichage", - "Sort by Name": "Trier par nom", "Time Granularity": "Granularité temporelle", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Agréger par mois", diff --git a/src/locales/helpers.ts b/src/locales/helpers.ts index 9dc6f1bb..a0291585 100644 --- a/src/locales/helpers.ts +++ b/src/locales/helpers.ts @@ -1,7 +1,13 @@ import { useI18n as useVueI18n } from 'vue-i18n'; import moment from 'moment-timezone'; -import type { NameValue, TypeAndName, TypeAndDisplayName, LocalizedSwitchOption } from '@/core/base.ts'; +import { + type NameValue, + type TypeAndName, + type TypeAndNameWithAlternativeName, + type TypeAndDisplayName, + type LocalizedSwitchOption +} from '@/core/base.ts'; import { type LanguageInfo, @@ -550,13 +556,19 @@ export function useI18n() { return ret; } - function getLocalizedDisplayNameAndType(typeAndNames: TypeAndName[]): TypeAndDisplayName[] { + function getLocalizedDisplayNameAndType(typeAndNames: TypeAndName[] | TypeAndNameWithAlternativeName[], useAlternativeName?: boolean): TypeAndDisplayName[] { const ret: TypeAndDisplayName[] = []; for (const typeAndName of typeAndNames) { + let name: string = typeAndName.name; + + if (useAlternativeName && 'alternativeName' in typeAndName && typeAndName.alternativeName) { + name = typeAndName.alternativeName; + } + ret.push({ type: typeAndName.type, - displayName: t(typeAndName.name) + displayName: t(name) }); } @@ -2392,7 +2404,7 @@ export function useI18n() { getAllTrendChartTypes: () => getLocalizedDisplayNameAndType(TrendChartType.values()), getAllAccountBalanceTrendChartTypes: () => getLocalizedDisplayNameAndType(AccountBalanceTrendChartType.values()), getAllStatisticsChartDataTypes: (analysisType: StatisticsAnalysisType, withDesktopOnlyChart?: boolean) => getLocalizedDisplayNameAndType(ChartDataType.values(analysisType, withDesktopOnlyChart)), - getAllStatisticsSortingTypes: () => getLocalizedDisplayNameAndType(ChartSortingType.values()), + getAllStatisticsSortingTypes: (useAlternativeName?: boolean) => getLocalizedDisplayNameAndType(ChartSortingType.values(), useAlternativeName), getAllStatisticsDateAggregationTypes: (analysisType: StatisticsAnalysisType) => getLocalizedChartDateAggregationTypeAndDisplayName(analysisType, true), getAllStatisticsDateAggregationTypesWithShortName: (analysisType: StatisticsAnalysisType) => getLocalizedChartDateAggregationTypeAndDisplayName(analysisType, false), getAllTransactionEditScopeTypes: () => getLocalizedDisplayNameAndType(TransactionEditScopeType.values()), diff --git a/src/locales/it.json b/src/locales/it.json index cc3042f4..93e3f638 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Importo massimo", "Display Order": "Ordine di visualizzazione", "Name": "Nome", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Ordina per importo", - "Sort by Display Order": "Ordina per ordine di visualizzazione", - "Sort by Name": "Ordina per nome", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Aggrega per mese", diff --git a/src/locales/ja.json b/src/locales/ja.json index 391b9241..325eb0d1 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "最大金額", "Display Order": "表示順", "Name": "名前", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "金額で並べ替え", - "Sort by Display Order": "表示で並べ替え", - "Sort by Name": "名前で並べ替え", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "月ごとに集計", diff --git a/src/locales/kn.json b/src/locales/kn.json index 1218bbf9..5125d068 100644 --- a/src/locales/kn.json +++ b/src/locales/kn.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "ಗರಿಷ್ಠ ಮೊತ್ತ", "Display Order": "ಪ್ರದರ್ಶಿಸುವ ಕ್ರಮ", "Name": "ಹೆಸರು", + "Value": "Value", "Proportion (%)": "ಪ್ರಮಾಣ (%)", - "Sort by Amount": "ಮೊತ್ತದ ಆಧಾರದ ಮೇಲೆ ವಿಂಗಡಿಸಿ", - "Sort by Display Order": "ಪ್ರದರ್ಶನ ಕ್ರಮದ ಆಧಾರದ ಮೇಲೆ ವಿಂಗಡಿಸಿ", - "Sort by Name": "ಹೆಸರಿನ ಆಧಾರದ ಮೇಲೆ ವಿಂಗಡಿಸಿ", "Time Granularity": "ಸಮಯದ ವಿವರ ಮಟ್ಟ", "Aggregate by Day": "ದಿನವಾರು ಒಕ್ಕೂಟ", "Aggregate by Month": "ತಿಂಗಳುವಾರು ಒಕ್ಕೂಟ", diff --git a/src/locales/ko.json b/src/locales/ko.json index c74c4435..344161e7 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "최대 금액", "Display Order": "표시 순서", "Name": "이름", + "Value": "Value", "Proportion (%)": "비율 (%)", - "Sort by Amount": "금액별 정렬", - "Sort by Display Order": "표시 순서별 정렬", - "Sort by Name": "이름별 정렬", "Time Granularity": "시간 세분화", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "월별 집계", diff --git a/src/locales/nl.json b/src/locales/nl.json index 09c32624..11d9923f 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Maximumbedrag", "Display Order": "Weergavevolgorde", "Name": "Naam", + "Value": "Value", "Proportion (%)": "Aandeel (%)", - "Sort by Amount": "Sorteren op bedrag", - "Sort by Display Order": "Sorteren op weergavevolgorde", - "Sort by Name": "Sorteren op naam", "Time Granularity": "Tijdgranulariteit", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Groeperen per maand", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index c541162d..b5818a22 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Montante Máximo", "Display Order": "Ordem de Exibição", "Name": "Nome", + "Value": "Value", "Proportion (%)": "Proporção (%)", - "Sort by Amount": "Classificar por Montante", - "Sort by Display Order": "Classificar por Ordem de Exibição", - "Sort by Name": "Classificar por Nome", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Agregado por Mês", diff --git a/src/locales/ru.json b/src/locales/ru.json index 53302083..df8c20b9 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Максимальная сумма", "Display Order": "Порядок отображения", "Name": "Имя", + "Value": "Value", "Proportion (%)": "Пропорция (%)", - "Sort by Amount": "Сортировать по сумме", - "Sort by Display Order": "Сортировать по порядку отображения", - "Sort by Name": "Сортировать по имени", "Time Granularity": "Детализация по времени", "Aggregate by Day": "Агрегировать по дням", "Aggregate by Month": "Агрегировать по месяцам", diff --git a/src/locales/sl.json b/src/locales/sl.json index 4bd3491e..d618cea9 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Največji znesek", "Display Order": "Vrstni red prikaza", "Name": "Ime", + "Value": "Value", "Proportion (%)": "Delež (%)", - "Sort by Amount": "Razvrsti po znesku", - "Sort by Display Order": "Razvrsti po vrstnem redu prikaza", - "Sort by Name": "Razvrsti po imenu", "Time Granularity": "Časovna ločljivost", "Aggregate by Day": "Združi po dnevih", "Aggregate by Month": "Združi po mesecih", diff --git a/src/locales/ta.json b/src/locales/ta.json index a4999353..9960de3d 100644 --- a/src/locales/ta.json +++ b/src/locales/ta.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "அதிகபட்சம் தொகை", "Display Order": "காட்டும் வரிசை", "Name": "பெயர்", + "Value": "Value", "Proportion (%)": "அளவு (%)", - "Sort by Amount": "தொகை அடிப்படையில் மேல் வரிசைப்படுத்து", - "Sort by Display Order": "காட்சி வரிசை அடிப்படையில் மேல் வரிசைப்படுத்து", - "Sort by Name": "ஹெசரி அடிப்படையில் மேல் வரிசைப்படுத்து", "Time Granularity": "நேர நுணுக்கம்", "Aggregate by Day": "தினசரி கூட்டமைப்பு", "Aggregate by Month": "மாதம்வாரி கூட்டமைப்பு", diff --git a/src/locales/th.json b/src/locales/th.json index 1df8f3d4..e0879b4d 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "จำนวนเงินสูงสุด", "Display Order": "ลำดับการแสดง", "Name": "ชื่อ", + "Value": "Value", "Proportion (%)": "สัดส่วน (%)", - "Sort by Amount": "เรียงตามจำนวนเงิน", - "Sort by Display Order": "เรียงตามลำดับการแสดง", - "Sort by Name": "เรียงตามชื่อ", "Time Granularity": "ความละเอียดเวลา", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "รวมตามเดือน", diff --git a/src/locales/tr.json b/src/locales/tr.json index 5b113aa5..1547ae6d 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Maksimum Tutar", "Display Order": "Görüntüleme Sırası", "Name": "İsim", + "Value": "Value", "Proportion (%)": "Oran (%)", - "Sort by Amount": "Tutara Göre Sırala", - "Sort by Display Order": "Görüntüleme Sırasına Göre Sırala", - "Sort by Name": "İsme Göre Sırala", "Time Granularity": "Zaman Ayrıntısı", "Aggregate by Day": "Güne Göre Topla", "Aggregate by Month": "Aya Göre Topla", diff --git a/src/locales/uk.json b/src/locales/uk.json index f89502d6..41f713e3 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Максимальна сума", "Display Order": "Порядок відображення", "Name": "Ім'я", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Сортувати за сумою", - "Sort by Display Order": "Сортувати за порядком відображення", - "Sort by Name": "Сортувати за назвою", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Агрегувати за місяцями", diff --git a/src/locales/vi.json b/src/locales/vi.json index 1a2ce31a..eee30bd5 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "Số tiền tối đa", "Display Order": "Thứ tự hiển thị", "Name": "Tên", + "Value": "Value", "Proportion (%)": "Proportion (%)", - "Sort by Amount": "Sắp xếp theo số tiền", - "Sort by Display Order": "Sắp xếp theo thứ tự hiển thị", - "Sort by Name": "Sắp xếp theo tên", "Time Granularity": "Time Granularity", "Aggregate by Day": "Aggregate by Day", "Aggregate by Month": "Tổng hợp theo tháng", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 0ce0797a..fea7f812 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "最大金额", "Display Order": "显示顺序", "Name": "名称", + "Value": "值", "Proportion (%)": "比例 (%)", - "Sort by Amount": "按金额排序", - "Sort by Display Order": "按显示顺序排序", - "Sort by Name": "按名称排序", "Time Granularity": "时间粒度", "Aggregate by Day": "按日聚合", "Aggregate by Month": "按月聚合", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index 5b462230..d9d29873 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -2177,10 +2177,8 @@ "Maximum Amount": "最大金額", "Display Order": "顯示順序", "Name": "名稱", + "Value": "值", "Proportion (%)": "比例 (%)", - "Sort by Amount": "依金額排序", - "Sort by Display Order": "依顯示順序排序", - "Sort by Name": "依名稱排序", "Time Granularity": "時間粒度", "Aggregate by Day": "依日彙整", "Aggregate by Month": "依月份彙整", diff --git a/src/views/desktop/insights/tabs/ExplorerChartTab.vue b/src/views/desktop/insights/tabs/ExplorerChartTab.vue index bf9be6db..22258de4 100644 --- a/src/views/desktop/insights/tabs/ExplorerChartTab.vue +++ b/src/views/desktop/insights/tabs/ExplorerChartTab.vue @@ -264,7 +264,7 @@ const defaultCurrency = computed(() => userStore.currentUserDefaultCurre const allTransactionExplorerDataDimensions = computed(() => getAllTransactionExplorerDataDimensions()); const allTransactionExplorerValueMetrics = computed(() => getAllTransactionExplorerValueMetrics()); const allTransactionExplorerChartTypes = computed(() => getAllTransactionExplorerChartTypes()); -const allTransactionExplorerChartSortingTypes = computed(() => getAllStatisticsSortingTypes()); +const allTransactionExplorerChartSortingTypes = computed(() => getAllStatisticsSortingTypes(true)); const currentTransactionExplorerCategoryDimensionName = computed(() => findNameByValue(allTransactionExplorerDataDimensions.value, currentExplorer.value.categoryDimension) ?? tt('Unknown')); const currentExplorer = computed(() => explorersStore.currentInsightsExplorer);