li.shaoyi 5 bulan lalu
induk
melakukan
36323b7554
1 mengubah file dengan 20 tambahan dan 21 penghapusan
  1. 20 21
      src/packages/mobile/App.vue

+ 20 - 21
src/packages/mobile/App.vue

@@ -46,6 +46,23 @@ const props = defineProps({
   }
 })
 
+const { t, locale } = i18n.global
+
+// 多语言列表
+const languageMap = {
+  [Language.Simplified]: zhCN,
+  [Language.English]: enUS,
+  [Language.Traditional]: zhTW,
+  [Language.Thai]: thTH,
+  [Language.Vietnamese]: viVN
+}
+
+if (locale in languageMap) {
+  Locale.use(locale, languageMap[locale])
+} else {
+  Locale.use('en-US', enUS)
+}
+
 const { userLogout } = useLogin()
 const { backHome } = useNavigation()
 
@@ -71,7 +88,7 @@ const changeMessage = (value: number) => {
   }
 }
 
-// 顶部通知
+// 浮动通知
 const notify = reactive({
   show: false,
   title: '',
@@ -89,7 +106,7 @@ eventBus.$on('RiskToWebNtf', (msg, type) => {
     dialog({
       title: res.title,
       message: res.content,
-      confirmButtonText: '确定'
+      confirmButtonText: t('operation.confirm')
     })
   }
 })
@@ -100,7 +117,7 @@ eventBus.$on('LogoutNotify', (msg) => {
     if (msg) {
       dialog({
         message: msg as string,
-        confirmButtonText: '确定'
+        confirmButtonText: t('operation.confirm')
       }).then(() => {
         backHome()
       })
@@ -110,24 +127,6 @@ eventBus.$on('LogoutNotify', (msg) => {
   })
 })
 
-// 多语言列表
-const languageMap = {
-  [Language.Simplified]: zhCN,
-  [Language.English]: enUS,
-  [Language.Traditional]: zhTW,
-  [Language.Thai]: thTH,
-  [Language.Vietnamese]: viVN
-}
-
-// 当前语言
-const language = i18n.global.locale
-
-if (language in languageMap) {
-  Locale.use(language, languageMap[language])
-} else {
-  Locale.use('en-US', enUS)
-}
-
 watch(() => noticeStore.isInitialized, () => {
   const readKey = 'read_' + loginStore.loginId
   const readValue = formatDate(new Date().toISOString(), 'YYYY-MM-DD')