refactor(i18n): change locale files to yaml format, closes #96 (#97)

This commit is contained in:
userquin authored and GitHub committed 2021-03-19 22:32:17 +08:00
1 parent 711d1c845d
commit 23dc1cd483
22 files changed
+135 -169

No files matched your search

+3 -2
View File
@@ -5,9 +5,10 @@ import { UserModule } from '~/types'
// https://vitejs.dev/guide/features.html#glob-import
const messages = Object.fromEntries(
Object.entries(
import.meta.globEager('../../locales/*.json'))
import.meta.globEager('../../locales/*.y(a)?ml'))
.map(([key, value]) => {
return [key.slice(14, -5), value.default]
const yaml = key.endsWith('.yaml')
return [key.slice(14, yaml ? -5 : -4), value.default]
}),
)