From 8da3d2aa35866675e8cf8bdac11d126382189ca8 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 11 Jan 2025 00:49:21 +0800 Subject: [PATCH] migrate i18n helper.js some code to typescript and migrate vue file to composition API and typescript --- src/DesktopApp.vue | 164 ++++--- src/MobileApp.vue | 389 ++++++++-------- src/components/common/MapView.vue | 2 +- src/components/desktop/ConfirmDialog.vue | 9 +- src/components/desktop/SnackBar.vue | 5 +- .../desktop/SwitchToMobileDialog.vue | 12 +- src/components/mobile/ColorSelectionSheet.vue | 6 +- src/components/mobile/IconSelectionSheet.vue | 6 +- src/components/mobile/InformationSheet.vue | 6 +- src/components/mobile/MapSheet.vue | 14 +- src/components/mobile/PasscodeInputSheet.vue | 12 +- src/components/mobile/PasswordInputSheet.vue | 12 +- src/components/mobile/PinCodeInputSheet.vue | 8 +- src/core/datetime.ts | 5 + src/desktop-main.js | 2 +- src/global.d.ts | 12 + src/lib/map/amap.ts | 2 +- src/lib/map/baidumap.ts | 2 +- src/lib/map/base.ts | 2 +- src/lib/map/googlemap.ts | 2 +- src/lib/map/index.ts | 2 +- src/lib/map/leaflet.ts | 2 +- src/lib/services.ts | 2 +- src/locales/helper.js | 34 +- src/locales/helpers.ts | 420 ++++++++++++++++++ src/locales/index.ts | 4 +- src/mobile-main.js | 2 +- src/stores/setting.ts | 2 +- src/views/desktop/MainLayout.vue | 287 ++++++------ vite.config.ts | 2 +- 30 files changed, 937 insertions(+), 492 deletions(-) create mode 100644 src/locales/helpers.ts diff --git a/src/DesktopApp.vue b/src/DesktopApp.vue index 1a8d4ccc..1fd43ad1 100644 --- a/src/DesktopApp.vue +++ b/src/DesktopApp.vue @@ -4,10 +4,10 @@ - {{ $t('Click to close') }} + {{ tt('Click to close') }}
- - {{ $t('global.app.title') }} + + {{ tt('global.app.title') }}
{{ currentNotificationContent }} @@ -15,11 +15,14 @@ - diff --git a/src/MobileApp.vue b/src/MobileApp.vue index 30e34167..6847b585 100644 --- a/src/MobileApp.vue +++ b/src/MobileApp.vue @@ -4,11 +4,16 @@ - diff --git a/vite.config.ts b/vite.config.ts index 82cc44a9..d8661f90 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -180,7 +180,7 @@ export default defineConfig(() => { return 'common'; } else if (/[\\/]src[\\/]components[\\/](base|common)[\\/]/i.test(id)) { return 'common'; - } else if (/[\\/]src[\\/]locales[\\/]helper\.(js|ts)/i.test(id)) { + } else if (/[\\/]src[\\/]locales[\\/]helpers\.(js|ts)/i.test(id)) { return 'common'; } else if (/[\\/]src[\\/]locales[\\/]/i.test(id)) { return 'locales';