提交 6f5bac08 编写于 作者: E Evan You

feat: i18n for edit link text

上级 d666872b
......@@ -65,6 +65,9 @@ module.exports = {
sidebar: {
'/guide/': genSidebarConfig('Guide'),
'/zh/guide/': genSidebarConfig('指南')
},
editLinkText: {
'/zh/': '在 GitHub 上编辑此页'
}
}
}
......@@ -82,6 +85,7 @@ function genSidebarConfig (title) {
'markdown',
'using-vue',
'custom-themes',
'i18n',
'deploy'
]
}
......
......@@ -2,7 +2,7 @@
<div class="page">
<Content :custom="false"/>
<div class="content edit-link" v-if="editLink">
<a :href="editLink" target="_blank" rel="noopener noreferrer">Edit this page</a>
<a :href="editLink" target="_blank" rel="noopener noreferrer">{{ editLinkText }}</a>
<OutboundLink/>
</div>
<div class="content page-nav" v-if="prev || next">
......@@ -76,6 +76,17 @@ export default {
path
)
}
},
editLinkText () {
const defualtValue = `Edit this page`
const { editLinkText } = this.$site.themeConfig
if (!editLinkText) {
return defualtValue
} else if (typeof editLinkText === 'string') {
return editLinkText
} else if (typeof editLinkText === 'object') {
return editLinkText[this.$localePath] || defualtValue
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册