Handy_Cao пре 8 месеци
родитељ
комит
057fa1ff20
4 измењених фајлова са 14 додато и 1 уклоњено
  1. 4 1
      src/constants/language.ts
  2. 3 0
      src/packages/pc/App.vue
  3. 1 0
      src/shims-vue.d.ts
  4. 6 0
      src/stores/modules/language.ts

+ 4 - 1
src/constants/language.ts

@@ -5,7 +5,8 @@ export enum Language {
     Simplified = 'zh-CN',
     Traditional = 'zh-TW',
     English = 'en-US',
-    Thai = 'th'
+    Thai = 'th',
+    VI = 'vi'
 }
 
 /**
@@ -18,6 +19,7 @@ export function getClientLanguage() {
         { result: Language.Traditional, code: ['zh-TW'] },
         { result: Language.English, code: ['en', 'en-US'] },
         { result: Language.Thai, code: ['th', 'th-TH'] },
+        { result: Language.VI, code: ['vi', 'vi'] },
     ]
     const lang = rules.find(rule => rule.code.includes(navigator.language))
     return lang ? lang.result : Language.English
@@ -33,5 +35,6 @@ export function getLanguageList() {
         { label: '繁体中文', value: Language.Traditional },
         { label: 'English', value: Language.English },
         { label: 'ภาษาไทย', value: Language.Thai },
+        { label: 'Việt nam', value: Language.VI },
     ]
 }

+ 3 - 0
src/packages/pc/App.vue

@@ -24,6 +24,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import en from 'element-plus/dist/locale/en.mjs'
 import th from 'element-plus/dist/locale/th.mjs'
 import zhTW from 'element-plus/dist/locale/zh-tw.mjs'
+import vi from 'element-plus/dist/locale/vi-VN.mjs'
 
 const { userLogout } = useLogin()
 const router = useRouter()
@@ -37,6 +38,8 @@ const locale = computed(() => {
       return th
     case Language.Traditional:
       return zhTW
+    case Language.VI:
+      return vi
     default:
       return zhCn
   }

+ 1 - 0
src/shims-vue.d.ts

@@ -21,6 +21,7 @@ declare module 'element-plus/dist/locale/zh-cn.mjs'
 declare module 'element-plus/dist/locale/en.mjs'
 declare module 'element-plus/dist/locale/th.mjs'
 declare module 'element-plus/dist/locale/zh-tw.mjs'
+declare module 'element-plus/dist/locale/vi-VN.mjs'
 declare module 'mockjs-x'
 declare module 'protobufjs'
 declare module '*.jpg'

+ 6 - 0
src/stores/modules/language.ts

@@ -3,6 +3,7 @@ import zhCN from '@public/locales/zh-CN.json'
 import enUS from '@public/locales/en-US.json'
 import thTH from '@public/locales/th-TH.json'
 import zhTW from '@public/locales/zh-TW.json'
+import viVN from '@public/locales/vi-VN.json'
 import { Language } from '@/constants/language'
 import { createI18n } from 'vue-i18n'
 import { localData } from '../storage'
@@ -15,6 +16,7 @@ export const i18n = createI18n({
         [Language.Traditional]: zhTW,
         [Language.English]: enUS,
         [Language.Thai]: thTH,
+        [Language.VI]: viVN,
     }
 })
 
@@ -32,4 +34,8 @@ axios('./locales/extras/en-US.json').then((res) => {
 
 axios('./locales/extras/th-TH.json').then((res) => {
     i18n.global.mergeLocaleMessage(Language.Thai, res.data)
+})
+
+axios('./locales/extras/vi-VN.json').then((res) => {
+    i18n.global.mergeLocaleMessage(Language.VI, res.data)
 })