feat(projects): 增加i18n支持翻译菜单,tab,title

This commit is contained in:
cc
2023-05-13 12:58:35 +08:00
parent a765da6e28
commit 3d48aa8bbe
19 changed files with 116 additions and 33 deletions

View File

@ -1,12 +1,14 @@
import type { App } from 'vue';
import { createI18n } from 'vue-i18n';
import { localStg } from '@/utils';
import messages from './lang';
import type { LocaleKey } from './lang';
const i18n = createI18n({
locale: 'zh-CN',
locale: localStg.get('lang') || 'zh-CN',
fallbackLocale: 'en',
messages
messages,
legacy: false
});
export function setupI18n(app: App) {
@ -18,5 +20,5 @@ export function t(key: string) {
}
export function setLocale(locale: LocaleKey) {
i18n.global.locale = locale;
i18n.global.locale.value = locale;
}