support calendar display type (Gregorian and Buddhist)

This commit is contained in:
MaysWind
2025-08-28 00:31:59 +08:00
parent c099443783
commit 411130db4e
47 changed files with 769 additions and 788 deletions
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD.MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "HH:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Transaktionsliste kann nicht abgerufen werden",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Benutzerdefinierter Datumsbereich",
"Select Month": "Select Month",
"Transaction Detail": "Transaktionsdetails",
"No transaction data": "Keine Transaktionsdaten",
"Are you sure you want to delete this transaction?": "Sind Sie sicher, dass Sie diese Transaktion löschen möchten?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Unable to retrieve transaction list",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Custom Date Range",
"Select Month": "Select Month",
"Transaction Detail": "Transaction Detail",
"No transaction data": "No transaction data",
"Are you sure you want to delete this transaction?": "Are you sure you want to delete this transaction?",
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD/MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "H:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "No se puede recuperar la lista de transacciones",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Rango de fechas personalizado",
"Select Month": "Select Month",
"Transaction Detail": "Detalle de la transacción",
"No transaction data": "Sin datos de transacción",
"Are you sure you want to delete this transaction?": "¿Está seguro de que desea eliminar esta transacción?",
+22 -19
View File
@@ -669,20 +669,20 @@ export function useI18n() {
}
function getDateTimeFormatOptions(options?: { calendarType?: CalendarType, numeralSystem?: NumeralSystem }): DateTimeFormatOptions {
let calendarType: CalendarType | undefined = options?.calendarType;
let numeralSystem: NumeralSystem | undefined = options?.numeralSystem;
if (!isDefined(calendarType)) {
calendarType = getCurrentDateDisplayType().calendarType;
}
let calendarType: CalendarType | undefined = options?.calendarType;
if (!isDefined(numeralSystem)) {
numeralSystem = getCurrentNumeralSystemType();
}
if (!isDefined(calendarType)) {
calendarType = getCurrentDateDisplayType().calendarType;
}
return {
calendarType: calendarType,
numeralSystem: numeralSystem,
calendarType: calendarType,
localeData: getDateTimeLocaleData()
};
}
@@ -966,10 +966,10 @@ export function useI18n() {
return ret;
}
function getLocalizedDateTimeFormats<T extends DateFormat | TimeFormat>(type: string, allFormatMap: Record<string, T>, allFormatArray: T[], languageDefaultTypeNameKey: string, systemDefaultFormatType: T, calendarType?: CalendarType): LocalizedDateTimeFormat[] {
function getLocalizedDateTimeFormats<T extends DateFormat | TimeFormat>(type: string, allFormatMap: Record<string, T>, allFormatArray: T[], languageDefaultTypeNameKey: string, systemDefaultFormatType: T, numeralSystem: NumeralSystem, calendarType?: CalendarType): LocalizedDateTimeFormat[] {
const defaultFormat = getLocalizedDateTimeFormat<T>(type, allFormatMap, allFormatArray, LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE, languageDefaultTypeNameKey, systemDefaultFormatType);
const ret: LocalizedDateTimeFormat[] = [];
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: calendarType });
const dateTimeFormatOptions = getDateTimeFormatOptions({ numeralSystem, calendarType });
ret.push({
type: LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE,
@@ -1127,7 +1127,7 @@ export function useI18n() {
];
}
function getAllFiscalYearFormats(): TypeAndDisplayName[] {
function getAllFiscalYearFormats(numeralSystem: NumeralSystem, calendarType: CalendarType): TypeAndDisplayName[] {
const now = getCurrentUnixTime();
let fiscalYearStart = userStore.currentUserFiscalYearStart;
@@ -1146,7 +1146,7 @@ export function useI18n() {
ret.push({
type: LANGUAGE_DEFAULT_FISCAL_YEAR_FORMAT_VALUE,
displayName: `${t('Language Default')} (${formatTimeRangeToFiscalYearFormat(defaultFiscalYearFormat, currentFiscalYearRange)})`
displayName: `${t('Language Default')} (${formatTimeRangeToFiscalYearFormat(defaultFiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType)})`
});
const allFiscalYearFormats = FiscalYearFormat.values();
@@ -1156,7 +1156,7 @@ export function useI18n() {
ret.push({
type: fiscalYearFormat.type,
displayName: formatTimeRangeToFiscalYearFormat(fiscalYearFormat, currentFiscalYearRange),
displayName: formatTimeRangeToFiscalYearFormat(fiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType),
});
}
@@ -1728,7 +1728,7 @@ export function useI18n() {
return formatYearQuarter(year, quarter);
}
function formatYearQuarter(year: number, quarter: number): string {
function formatYearQuarter(year: number | string, quarter: number): string {
if (1 <= quarter && quarter <= 4) {
return t('format.yearQuarter.q' + quarter, {
year: year,
@@ -1788,12 +1788,12 @@ export function useI18n() {
return `${displayStartTime} ~ ${displayEndTime}`;
}
function formatTimeRangeToFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange): string {
function formatTimeRangeToFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange, numeralSystem?: NumeralSystem, calendarType?: CalendarType): string {
if (!format) {
format = FiscalYearFormat.Default;
}
const dateTimeFormatOptions = getDateTimeFormatOptions();
const dateTimeFormatOptions = getDateTimeFormatOptions({ numeralSystem, calendarType });
return t('format.fiscalYear.' + format.typeName, {
StartYYYY: formatUnixTime(timeRange.minUnixTime, 'YYYY', dateTimeFormatOptions),
@@ -2193,10 +2193,10 @@ export function useI18n() {
getAllWeekDays,
getAllCalendarDisplayTypes: () => getAllLocalizedCalendarTypes(CalendarDisplayType.values(), CalendarDisplayType.parse(t('default.calendarDisplayType')), CalendarDisplayType.Default, CalendarDisplayType.LanguageDefaultType),
getAllDateDisplayTypes: () => getAllLocalizedCalendarTypes(DateDisplayType.values(), DateDisplayType.parse(t('default.dateDisplayType')), DateDisplayType.Default, DateDisplayType.LanguageDefaultType),
getAllLongDateFormats: (calendarType?: CalendarType) => getLocalizedDateTimeFormats<LongDateFormat>('longDate', LongDateFormat.all(), LongDateFormat.values(), 'longDateFormat', LongDateFormat.Default, calendarType),
getAllShortDateFormats: (calendarType?: CalendarType) => getLocalizedDateTimeFormats<ShortDateFormat>('shortDate', ShortDateFormat.all(), ShortDateFormat.values(), 'shortDateFormat', ShortDateFormat.Default, calendarType),
getAllLongTimeFormats: (calendarType?: CalendarType) => getLocalizedDateTimeFormats<LongTimeFormat>('longTime', LongTimeFormat.all(), LongTimeFormat.values(), 'longTimeFormat', LongTimeFormat.Default, calendarType),
getAllShortTimeFormats: (calendarType?: CalendarType) => getLocalizedDateTimeFormats<ShortTimeFormat>('shortTime', ShortTimeFormat.all(), ShortTimeFormat.values(), 'shortTimeFormat', ShortTimeFormat.Default, calendarType),
getAllLongDateFormats: (numeralSystem: NumeralSystem, calendarType: CalendarType) => getLocalizedDateTimeFormats<LongDateFormat>('longDate', LongDateFormat.all(), LongDateFormat.values(), 'longDateFormat', LongDateFormat.Default, numeralSystem, calendarType),
getAllShortDateFormats: (numeralSystem: NumeralSystem, calendarType: CalendarType) => getLocalizedDateTimeFormats<ShortDateFormat>('shortDate', ShortDateFormat.all(), ShortDateFormat.values(), 'shortDateFormat', ShortDateFormat.Default, numeralSystem, calendarType),
getAllLongTimeFormats: (numeralSystem: NumeralSystem) => getLocalizedDateTimeFormats<LongTimeFormat>('longTime', LongTimeFormat.all(), LongTimeFormat.values(), 'longTimeFormat', LongTimeFormat.Default, numeralSystem),
getAllShortTimeFormats: (numeralSystem: NumeralSystem) => getLocalizedDateTimeFormats<ShortTimeFormat>('shortTime', ShortTimeFormat.all(), ShortTimeFormat.values(), 'shortTimeFormat', ShortTimeFormat.Default, numeralSystem),
getAllFiscalYearFormats,
getAllDateRanges,
getAllRecentMonthDateRanges,
@@ -2256,7 +2256,10 @@ export function useI18n() {
isLongTimeMinuteTwoDigits,
isLongTimeSecondTwoDigits,
// format functions
formatUnixTimeToDefaultDateTimeWithoutLocaleOptions: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, KnownDateTimeFormat.DefaultDateTime.format, getDateTimeFormatOptions({ calendarType: CalendarType.Gregorian, numeralSystem: NumeralSystem.WesternArabicNumerals }), utcOffset, currentUtcOffset),
getCalendarShortYearFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset),
getCalendarShortMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMM', getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset),
getCalendarDayOfMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDayFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset),
formatUnixTimeToDefaultDateTimeWithoutLocaleOptions: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, KnownDateTimeFormat.DefaultDateTime.format, getDateTimeFormatOptions({ numeralSystem: NumeralSystem.WesternArabicNumerals, calendarType: CalendarType.Gregorian }), utcOffset, currentUtcOffset),
formatUnixTimeToLongDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongDateFormat() + ' ' + getLocalizedLongTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
formatUnixTimeToShortDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDateFormat() + ' ' + getLocalizedShortTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
formatUnixTimeToLongDate: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongDateFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD/MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "HH:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Impossibile recuperare l'elenco delle transazioni",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Intervallo date personalizzato",
"Select Month": "Select Month",
"Transaction Detail": "Dettaglio transazione",
"No transaction data": "Nessun dato di transazione",
"Are you sure you want to delete this transaction?": "Sei sicuro di voler eliminare questa transazione?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "取引リストを取得できません",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "カスタム日付範囲",
"Select Month": "Select Month",
"Transaction Detail": "取引の詳細",
"No transaction data": "取引データがありません",
"Are you sure you want to delete this transaction?": "この取引を削除しますか?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Kan transactielijst niet ophalen",
"Unable to retrieve reconciliation statements": "Kan afstemmingsrapporten niet ophalen",
"Custom Date Range": "Aangepast datumbereik",
"Select Month": "Select Month",
"Transaction Detail": "Transactiedetail",
"No transaction data": "Geen transactiegegevens",
"Are you sure you want to delete this transaction?": "Weet je zeker dat je deze transactie wilt verwijderen?",
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD/MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "HH:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Incapaz de recuperar a lista de transações",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Intervalo de Datas Personalizado",
"Select Month": "Select Month",
"Transaction Detail": "Detalhes da Transação",
"No transaction data": "Sem dados de transação",
"Are you sure you want to delete this transaction?": "Tem certeza de que deseja excluir esta transação?",
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD.MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "H:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Не удалось получить список транзакций",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Пользовательский диапазон дат",
"Select Month": "Select Month",
"Transaction Detail": "Детали транзакции",
"No transaction data": "Нет данных о транзакциях",
"Are you sure you want to delete this transaction?": "Вы уверены, что хотите удалить эту транзакцию?",
+5 -5
View File
@@ -76,9 +76,9 @@
"dd_mm_yyyy": "DD.MM"
},
"shortDay": {
"yyyy_mm_dd": "DD",
"mm_dd_yyyy": "DD",
"dd_mm_yyyy": "DD"
"yyyy_mm_dd": "D",
"mm_dd_yyyy": "D",
"dd_mm_yyyy": "D"
},
"longTime": {
"hh_mm_ss": "HH:mm:ss",
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Не вдалося отримати список транзакцій",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Користувацький діапазон дат",
"Select Month": "Select Month",
"Transaction Detail": "Деталі транзакції",
"No transaction data": "Немає даних про транзакції",
"Are you sure you want to delete this transaction?": "Ви впевнені, що хочете видалити цю транзакцію?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "Gregorian",
"Buddhist": "Buddhist",
"Gregorian (with Chinese Calendar)": "Gregorian (with Chinese Calendar)"
"Buddhist": "Buddhist"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "Không thể lấy danh sách giao dịch",
"Unable to retrieve reconciliation statements": "Unable to retrieve reconciliation statements",
"Custom Date Range": "Phạm vi ngày tùy chỉnh",
"Select Month": "Select Month",
"Transaction Detail": "Chi tiết giao dịch",
"No transaction data": "Không có dữ liệu giao dịch",
"Are you sure you want to delete this transaction?": "Bạn có chắc chắn muốn xóa giao dịch này không?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "公历",
"Buddhist": "佛教日历",
"Gregorian (with Chinese Calendar)": "公历(含农历)"
"Buddhist": "佛教日历"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "无法获取交易列表",
"Unable to retrieve reconciliation statements": "无法获取对账单",
"Custom Date Range": "自定义日期范围",
"Select Month": "选择月份",
"Transaction Detail": "交易详情",
"No transaction data": "没有交易数据",
"Are you sure you want to delete this transaction?": "您确定要删除该交易?",
+2 -2
View File
@@ -138,8 +138,7 @@
},
"calendar": {
"Gregorian": "公曆",
"Buddhist": "佛曆",
"Gregorian (with Chinese Calendar)": "公曆(含農曆)"
"Buddhist": "佛曆"
},
"datetime": {
"AM": {
@@ -1857,6 +1856,7 @@
"Unable to retrieve transaction list": "無法取得交易清單",
"Unable to retrieve reconciliation statements": "無法取得對帳單",
"Custom Date Range": "自訂日期範圍",
"Select Month": "選擇月份",
"Transaction Detail": "交易明細",
"No transaction data": "沒有交易資料",
"Are you sure you want to delete this transaction?": "您確定要刪除這筆交易?",