25 lines
573 B
TypeScript
25 lines
573 B
TypeScript
import { createI18n } from 'vue-i18n'
|
|
// import { UserModule } from '~/types'
|
|
|
|
// import i18n resources
|
|
// https://vitejs.dev/guide/features.html#glob-import
|
|
export const messages = Object.fromEntries(
|
|
Object.entries(
|
|
import.meta.globEager('../../locales/*.y(a)?ml'))
|
|
.map(([key, value]) => {
|
|
const yaml = key.endsWith('.yaml')
|
|
return [key.slice(14, yaml ? -5 : -4), value.default]
|
|
}),
|
|
)
|
|
/*
|
|
export const install: UserModule = ({ app }) => {
|
|
const i18n = createI18n({
|
|
legacy: false,
|
|
locale: 'en',
|
|
messages,
|
|
})
|
|
|
|
app.use(i18n)
|
|
}
|
|
|
|
*/ |