meface/docs/.vuepress/theme/mixins/locales.js

24 lines
617 B
JavaScript
Raw Normal View History

2023-11-17 10:54:23 +08:00
import { zhHans, zhHant, en, ja, ko } from '../locales/index'
export default {
computed: {
$recoLocales () {
const recoLocales = this.$themeLocaleConfig.recoLocales || {}
if (/^zh\-(CN|SG)$/.test(this.$lang)) {
return { ...zhHans, ...recoLocales }
}
if (/^zh\-(HK|MO|TW)$/.test(this.$lang)) {
return { ...zhHant, ...recoLocales }
}
if (/^ja\-JP$/.test(this.$lang)) {
return { ...ja, ...recoLocales }
}
if (/^ko\-KR$/.test(this.$lang)) {
return { ...ko, ...recoLocales }
}
return { ...en, ...recoLocales }
}
}
}