feat: multi-language(part.1)
This commit is contained in:
parent
7fc9eaa42a
commit
d2bb87bdb1
@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div class="info-wrapper">
|
||||
<PersonalInfo/>
|
||||
<h4><i class="iconfont reco-category"></i> 分类</h4>
|
||||
<h4><i class="iconfont reco-category"></i> {{homeBlogCfg.category}}</h4>
|
||||
<ul class="category-wrapper">
|
||||
<li class="category-item" v-for="(item, index) in this.$categories.list" :key="index">
|
||||
<router-link :to="item.path">
|
||||
@ -59,9 +59,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h4 v-if="$tags.list.length !== 0"><i class="iconfont reco-tag"></i> 标签</h4>
|
||||
<h4 v-if="$tags.list.length !== 0"><i class="iconfont reco-tag"></i> {{homeBlogCfg.tag}}</h4>
|
||||
<TagList @getCurrentTag="getPagesByTags" />
|
||||
<h4 v-if="$themeConfig.friendLink && $themeConfig.friendLink.length !== 0"><i class="iconfont reco-friend"></i> 友链</h4>
|
||||
<h4 v-if="$themeConfig.friendLink && $themeConfig.friendLink.length !== 0"><i class="iconfont reco-friend"></i> {{homeBlogCfg.friendLink}}</h4>
|
||||
<FriendLink />
|
||||
</div>
|
||||
</div>
|
||||
@ -94,6 +94,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
homeBlogCfg () {
|
||||
return this.$recoLocals.homeBlog
|
||||
},
|
||||
actionLink () {
|
||||
const {
|
||||
actionLink: link,
|
||||
@ -130,6 +133,7 @@ export default {
|
||||
mounted () {
|
||||
this.recoShow = true
|
||||
this._setPage(this._getStoragePage())
|
||||
console.log(this)
|
||||
},
|
||||
methods: {
|
||||
// 获取当前页码
|
||||
|
@ -1,7 +1,9 @@
|
||||
import postMixin from '@theme/mixins/posts'
|
||||
import localMixin from '@theme/mixins/locals'
|
||||
|
||||
export default ({
|
||||
Vue
|
||||
}) => {
|
||||
Vue.mixin(postMixin)
|
||||
Vue.mixin(localMixin)
|
||||
}
|
||||
|
8
locals/en.js
Normal file
8
locals/en.js
Normal file
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
homeBlog: {
|
||||
article: 'article',
|
||||
tag: 'tag',
|
||||
category: 'category',
|
||||
friendLink: 'friend link'
|
||||
}
|
||||
}
|
4
locals/index.js
Normal file
4
locals/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
import zhHans from './zh-hans.js'
|
||||
import zhHant from './zh-hant.js'
|
||||
import en from './en.js'
|
||||
export { zhHans, zhHant, en }
|
8
locals/zh-hans.js
Normal file
8
locals/zh-hans.js
Normal file
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
homeBlog: {
|
||||
article: '文章',
|
||||
tag: '标签',
|
||||
category: '分类',
|
||||
friendLink: '友情链接'
|
||||
}
|
||||
}
|
8
locals/zh-hant.js
Normal file
8
locals/zh-hant.js
Normal file
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
homeBlog: {
|
||||
article: '文章',
|
||||
tag: '標簽',
|
||||
category: '分類',
|
||||
friendLink: '友情鏈接'
|
||||
}
|
||||
}
|
15
mixins/locals.js
Normal file
15
mixins/locals.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { zhHans, zhHant, en } from '../locals/index'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
$recoLocals () {
|
||||
if (/^zh\-(CN|SG)$/.test(this.$lang)) {
|
||||
return zhHans
|
||||
}
|
||||
if (/^zh\-(HK|MO|TW)$/.test(this.$lang)) {
|
||||
return zhHant
|
||||
}
|
||||
return en
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user