wip(i18n): Config i18n

This commit is contained in:
kailong321200875
2021-12-14 21:27:43 +08:00
parent d7d0ada558
commit 3e002a68f2
5 changed files with 91 additions and 505 deletions

View File

@@ -1,7 +1,8 @@
import { createI18n } from 'vue-i18n'
import type { App } from 'vue'
import type { I18nOptions } from 'vue-i18n'
// export let i18n: ReturnType<typeof createI18n>
export let i18n: ReturnType<typeof createI18n>
const messages = Object.fromEntries(
Object.entries(import.meta.globEager('../../locales/*.ts')).map(([key, value]) => {
@@ -10,10 +11,10 @@ const messages = Object.fromEntries(
)
export function setupI18n(app: App): void {
const i18n = createI18n({
i18n = createI18n({
legacy: false,
locale: 'zh-CN',
messages
})
} as I18nOptions)
app.use(i18n)
}