cn locales to vuetify standard

This commit is contained in:
Alireza Ahmadi
2024-06-15 20:11:39 +02:00
parent f5792c9d82
commit ccbd591b39
4 changed files with 23 additions and 8 deletions
+9 -1
View File
@@ -42,6 +42,7 @@
<script lang="ts">
import DatePicker from 'vue3-persian-datetime-picker'
import { i18n } from '@/locales'
import 'moment/locale/vi'
import 'moment/locale/zh-cn'
import 'moment/locale/zh-tw'
@@ -58,7 +59,14 @@ export default {
computed: {
locale() {
const l = i18n.global.locale.value
return l.replace('zh', 'zh-')
switch (l) {
case "zhHans":
return "zh-cn"
case "zhHant":
return "zh-tw"
default:
return l
}
},
dateFormatted() {
if (this.expDate == 0) return i18n.global.t('unlimited')
+8 -1
View File
@@ -120,7 +120,14 @@ export default {
computed: {
locale() {
const l = i18n.global.locale.value
return l.replace('zh', 'zh-')
switch (l) {
case "zhHans":
return "zh-cn"
case "zhHant":
return "zh-tw"
default:
return l
}
},
},
watch: {
+4 -4
View File
@@ -13,8 +13,8 @@ export const i18n = createI18n({
en: en,
fa: fa,
vi: vi,
zhcn: zhcn,
zhtw: zhtw
zhHans: zhcn,
zhHant: zhtw
},
})
@@ -22,6 +22,6 @@ export const languages = [
{ title: 'English', value: 'en' },
{ title: 'فارسی', value: 'fa' },
{ title: 'Tiếng Việt', value: 'vi' },
{ title: '简体中文', value: 'zhcn' },
{ title: '繁體中文', value: 'zhtw' },
{ title: '简体中文', value: 'zhHans' },
{ title: '繁體中文', value: 'zhHant' },
]
+2 -2
View File
@@ -9,7 +9,7 @@ import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
import colors from 'vuetify/util/colors'
import { fa, en, vi, zhHans as zhcn, zhHant as zhtw } from 'vuetify/locale'
import { fa, en, vi, zhHans, zhHant } from 'vuetify/locale'
// Composables
import { createVuetify } from 'vuetify'
@@ -53,6 +53,6 @@ export default createVuetify({
locale: {
locale: localStorage.getItem("locale") ?? 'en',
fallback: 'en',
messages: { en, fa, vi, zhcn, zhtw },
messages: { en, fa, vi, zhHans, zhHant },
},
})