feat: use module
This commit is contained in:
parent
654010b3aa
commit
c2f3526e88
7 changed files with 251 additions and 57 deletions
|
@ -1,25 +0,0 @@
|
|||
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)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue