feat: install and configure i18n features (#177)

Co-authored-by: Shinigami <chrissi92@hotmail.de>
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
Ayaka Rizumu 2022-11-28 14:58:29 +08:00 committed by GitHub
parent 443bd65c05
commit 871076f2d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 170 additions and 16 deletions

25
plugins/i18n.ts Normal file
View file

@ -0,0 +1,25 @@
import { createI18n } from 'vue-i18n'
import enUS from '../locales/en-US.json'
import zhCn from '../locales/zh-CN.json'
/** Default language environment */
export const defaultLocale = 'en-US'
export const messages = {
'en-US': enUS,
'zh-CN': zhCn,
}
/** Language Environment List */
export const localeList = Object.keys(messages)
export default defineNuxtPlugin(({ vueApp }) => {
const i18n = createI18n({
legacy: false,
globalInjection: true,
locale: defaultLocale,
messages,
})
vueApp.use(i18n)
})