feat(i18n): add zh-tw
This commit is contained in:
@@ -6,6 +6,7 @@ import ko from 'element-plus/es/locale/lang/ko'
|
||||
import ru from 'element-plus/es/locale/lang/ru'
|
||||
import fr from 'element-plus/es/locale/lang/fr'
|
||||
import es from 'element-plus/es/locale/lang/es'
|
||||
import zhTw from 'element-plus/es/locale/lang/zh-tw'
|
||||
import { admin, app } from '@/api/config'
|
||||
|
||||
const langs = {
|
||||
@@ -15,6 +16,7 @@ const langs = {
|
||||
'ko': { name: '한국어', value: ko, sideBarWidth: '230px' },
|
||||
'ru': { name: 'русский', value: ru, sideBarWidth: '250px' },
|
||||
'es': { name: 'español', value: es, sideBarWidth: '280px' },
|
||||
'zh-TW': { name: '中文繁体', value: zhTw, sideBarWidth: '210px' },
|
||||
}
|
||||
const defaultLang = localStorage.getItem('lang') || navigator.language || 'zh-CN'
|
||||
export const useAppStore = defineStore({
|
||||
|
||||
+5
-3
@@ -4,11 +4,9 @@ import zhCN from '@/utils/i18n/zh_CN.json'
|
||||
import ko from '@/utils/i18n/ko.json'
|
||||
import ru from '@/utils/i18n/ru.json'
|
||||
import es from '@/utils/i18n/es.json'
|
||||
import zhTW from '@/utils/i18n/zh_TW.json'
|
||||
import { useAppStore } from '@/store/app'
|
||||
|
||||
export function T (key, params, num = 0) {
|
||||
const appStore = useAppStore()
|
||||
const lang = appStore.setting.lang
|
||||
const trans = {
|
||||
'en': en,
|
||||
'fr': fr,
|
||||
@@ -16,7 +14,11 @@ export function T (key, params, num = 0) {
|
||||
'ko': ko,
|
||||
'ru': ru,
|
||||
'es': es,
|
||||
'zh-TW': zhTW,
|
||||
}
|
||||
export function T (key, params, num = 0) {
|
||||
const appStore = useAppStore()
|
||||
const lang = appStore.setting.lang
|
||||
const tran = trans[lang]?.[key]
|
||||
if (!tran) {
|
||||
return key
|
||||
|
||||
Reference in New Issue
Block a user