新增多语言设置

This commit is contained in:
lyswhut
2020-02-19 20:41:34 +08:00
parent a17ba9f62c
commit b8f15bcca9
77 changed files with 1066 additions and 296 deletions
+27
View File
@@ -0,0 +1,27 @@
// http://kazupon.github.io/vue-i18n/en/messages.html
const requireLang = require.context(
'@/lang',
true,
/\.json$/,
)
const messages = {}
for (const file of requireLang.keys()) {
if (file === './index.js') continue
const path = file.replace(/(\.\/|\.json$)/g, '').split('/')
path.reduce((o, s, i) => {
if (o[s]) return o[s]
o[s] = i + 1 === path.length
? requireLang(file)
: {}
return o[s]
}, messages)
}
export default messages