-
Notifications
You must be signed in to change notification settings - Fork 18
/
.dumirc.ts
65 lines (61 loc) · 2.2 KB
/
.dumirc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { defineConfig } from 'dumi';
import { defineThemeConfig } from 'dumi-theme-nocobase';
import { nav, sidebar } from './docs/config';
const lang = process.env.DOC_LANG || 'zh-CN';
console.log('process.env.DOC_LANG', lang);
// 设置多语言的 title
function setTitle(menuChildren: any) {
if (!menuChildren) return;
menuChildren.forEach((item: any) => {
if (typeof item === 'object') {
item.title = item[`title.${lang}`] || item.title;
item.link = item[`link.${lang}`] || item.link;
if (item.children) {
setTitle(item.children);
}
}
});
}
if (lang !== 'en-US') {
Object.values(sidebar).forEach(setTitle);
}
export default defineConfig({
hash: true,
alias: {
},
// ssr: {},
exportStatic: {
ignorePreRenderError: true
},
cacheDirectoryPath: `node_modules/.docs-${lang}-cache`,
outputPath: `./dist/${lang}`,
resolve: {
docDirs: [`./docs/${lang}`]
},
locales: [
{ id: 'en-US', name: 'English' },
{ id: 'zh-CN', name: '中文' },
{ id: 'ja-JP', name: '日本語' },
],
themeConfig: defineThemeConfig({
title: 'NocoBase',
lang,
logo: 'https://www.nocobase.com/images/logo.png',
nav: nav.map((item) => ({ ...item, title: (item?.[`title.${lang}`] || item.title) })),
sidebarEnhance: sidebar as any,
github: 'https://github.com/nocobase/nocobase',
footer: '© 2020-2024 NocoBase. All rights reserved.',
alert: lang === 'zh-CN' ? '文档正在建设中,部分内容可能缺失或缺少翻译,详情查看 <a target="_blank" href="https://github.com/nocobase/docs/commits/main/">文档更新日志</a>' : 'The document is currently under construction, with some content possibly missing or awaiting translation. For details, please refer to the <a target="_blank" href="https://github.com/nocobase/docs/commits/main/">changelog</a>',
localesEnhance: [
{ id: 'zh-CN', switchPrefix: '中', hostname: 'docs-cn.nocobase.com' },
{ id: 'en-US', switchPrefix: 'en', hostname: 'docs.nocobase.com' },
{ id: 'ja-JP', switchPrefix: 'ja', hostname: 'docs-ja.nocobase.com' }
],
}),
favicons: [
'/favicon.ico',
'/favicon-32x32.png',
'/favicon-16x16.png',
],
// mfsu: true, // 报错
});