fix incorrect display name of sort type in the insight explorer

This commit is contained in:
MaysWind
2026-02-23 23:25:44 +08:00
parent b42f226aba
commit 61c52cc888
23 changed files with 48 additions and 70 deletions
+4
View File
@@ -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;
+8 -8
View File
@@ -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<number, ChartSortingType> = {};
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;
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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",
+16 -4
View File
@@ -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()),
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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": "月ごとに集計",
+1 -3
View File
@@ -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": "ತಿಂಗಳುವಾರು ಒಕ್ಕೂಟ",
+1 -3
View File
@@ -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": "월별 집계",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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": "Агрегировать по месяцам",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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": "மாதம்வாரி கூட்டமைப்பு",
+1 -3
View File
@@ -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": "รวมตามเดือน",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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": "Агрегувати за місяцями",
+1 -3
View File
@@ -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",
+1 -3
View File
@@ -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": "按月聚合",
+1 -3
View File
@@ -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": "依月份彙整",
@@ -264,7 +264,7 @@ const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurre
const allTransactionExplorerDataDimensions = computed<NameValue[]>(() => getAllTransactionExplorerDataDimensions());
const allTransactionExplorerValueMetrics = computed<NameValue[]>(() => getAllTransactionExplorerValueMetrics());
const allTransactionExplorerChartTypes = computed<NameValue[]>(() => getAllTransactionExplorerChartTypes());
const allTransactionExplorerChartSortingTypes = computed<TypeAndDisplayName[]>(() => getAllStatisticsSortingTypes());
const allTransactionExplorerChartSortingTypes = computed<TypeAndDisplayName[]>(() => getAllStatisticsSortingTypes(true));
const currentTransactionExplorerCategoryDimensionName = computed<string>(() => findNameByValue(allTransactionExplorerDataDimensions.value, currentExplorer.value.categoryDimension) ?? tt('Unknown'));
const currentExplorer = computed<InsightsExplorer>(() => explorersStore.currentInsightsExplorer);