mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
a5dd21e94a
* docs: refactor config * docs(build): support dev without pre build * docs: disable sourcemap
29 lines
695 B
TypeScript
29 lines
695 B
TypeScript
import { ensureLang } from '../utils/lang'
|
|
import navLocale from '../i18n/pages/sidebar.json'
|
|
|
|
// Mapping the first sub link to the nav link to avoid 404 error.
|
|
|
|
function getNav() {
|
|
return Object.fromEntries(
|
|
Object.entries(navLocale).map(([lang, val]) => {
|
|
const value: {
|
|
link: string
|
|
text: string
|
|
activeMatch?: string
|
|
}[] = Object.values(val).map((item) => ({
|
|
...item,
|
|
link: `${ensureLang(lang)}${item.link}`,
|
|
}))
|
|
|
|
value.push({
|
|
text: lang === 'zh-CN' ? '旧版文档' : 'Old Doc',
|
|
link: 'https://doc-archive.element-plus.org/',
|
|
})
|
|
|
|
return [lang, value]
|
|
})
|
|
)
|
|
}
|
|
|
|
export const nav = getNav()
|