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