Skip to content

Commit

Permalink
cn locales to vuetify standard
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 committed Jun 15, 2024
1 parent f5792c9 commit ccbd591
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
10 changes: 9 additions & 1 deletion frontend/src/components/DateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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')
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/layouts/modals/Changes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export const i18n = createI18n({
en: en,
fa: fa,
vi: vi,
zhcn: zhcn,
zhtw: zhtw
zhHans: zhcn,
zhHant: zhtw
},
})

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' },
]
4 changes: 2 additions & 2 deletions frontend/src/plugins/vuetify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 },
},
})

0 comments on commit ccbd591

Please sign in to comment.