From 20e95e35aa21a9cc2dc43bf38d19a5619b22f087 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 18 Jan 2025 18:11:47 +0800 Subject: [PATCH] migrate preset dialog to composition API and typescript --- src/locales/helpers.ts | 9 +- .../categories/list/dialogs/PresetDialog.vue | 163 +++++++++--------- 2 files changed, 82 insertions(+), 90 deletions(-) diff --git a/src/locales/helpers.ts b/src/locales/helpers.ts index 35621af4..a3a506f4 100644 --- a/src/locales/helpers.ts +++ b/src/locales/helpers.ts @@ -167,10 +167,6 @@ export function useI18n() { const userStore = useUserStore(); // private functions - function getLanguageInfo(languageKey: string): LanguageInfo | undefined { - return ALL_LANGUAGES[languageKey]; - } - function getLanguageDisplayName(languageName: string): string { return t(`language.${languageName}`); } @@ -950,6 +946,10 @@ export function useI18n() { return availableExchangeRates; } + function getLanguageInfo(languageKey: string): LanguageInfo | undefined { + return ALL_LANGUAGES[languageKey]; + } + function getMonthShortName(monthName: string): string { return t(`datetime.${monthName}.short`); } @@ -1337,6 +1337,7 @@ export function useI18n() { getAllTransactionDefaultCategories, getAllDisplayExchangeRates, // get localized info + getLanguageInfo, getMonthShortName, getMonthLongName, getMonthdayOrdinal, diff --git a/src/views/desktop/categories/list/dialogs/PresetDialog.vue b/src/views/desktop/categories/list/dialogs/PresetDialog.vue index 1fa01b5e..b09dc851 100644 --- a/src/views/desktop/categories/list/dialogs/PresetDialog.vue +++ b/src/views/desktop/categories/list/dialogs/PresetDialog.vue @@ -3,7 +3,7 @@ @@ -53,11 +53,11 @@
- {{ $t('Save') }} + {{ tt('Save') }} {{ $t('Cancel') }} + :disabled="submitting" @click="showState = false">{{ tt('Cancel') }}
@@ -66,103 +66,94 @@ -