Skip to content

Commit 0b958bf

Browse files
committed
feat: configure internationalisation for navbar and sidebar
1 parent de22e6d commit 0b958bf

File tree

5 files changed

+30
-14
lines changed

5 files changed

+30
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
node_modules
44

55
/docs/.vitepress/cache/
6+
/docs/.vitepress/dist/

docs/.vitepress/config.mts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import { defineConfig } from "vitepress"
22
import { shared } from "./shared"
3-
import { enGB } from './en-GB'
4-
import { zhCN } from './zh-CN'
3+
import { enGB } from "./en-GB"
4+
import { zhCN } from "./zh-CN"
55

66
// https://vitepress.dev/reference/site-config
77
export default defineConfig({
88
...shared,
99
locales: {
1010
root: {
1111
label: "English (Great Britain)",
12-
// lang: "en-GB",
1312
...enGB,
1413
},
1514
"zh-CN": {
1615
label: "Chinese (Simplified) | 简体中文",
17-
// lang: "zh-CN",
18-
// link: "/zh-CN",
1916
...zhCN,
2017
},
2118
},

docs/.vitepress/en-GB.ts

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const enGB = defineConfig({
55
description: "A non-profit open source developer organisation.",
66
themeConfig: {
77
nav: nav(),
8+
sidebar: sidebar(),
89
},
910
})
1011

@@ -17,3 +18,15 @@ function nav(): DefaultTheme.NavItem[] {
1718
},
1819
]
1920
}
21+
22+
function sidebar(): DefaultTheme.Sidebar {
23+
return [
24+
{
25+
text: "Examples",
26+
items: [
27+
{ text: "Markdown Examples", link: "/markdown-examples" },
28+
{ text: "Runtime API Examples", link: "/api-examples" },
29+
],
30+
},
31+
]
32+
}

docs/.vitepress/shared.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@ export const shared = defineConfig({
55
description: "OnixByte Official Site",
66
themeConfig: {
77
// https://vitepress.dev/reference/default-theme-config
8-
sidebar: [
9-
{
10-
text: "Examples",
11-
items: [
12-
{ text: "Markdown Examples", link: "/markdown-examples" },
13-
{ text: "Runtime API Examples", link: "/api-examples" },
14-
],
15-
},
16-
],
8+
179
socialLinks: [
1810
{ icon: "github", link: "https://github.com/onixbyte-opensource" },
1911
],

docs/.vitepress/zh-CN.ts

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const zhCN = defineConfig({
55
description: "一个非营利性开源开发者组织。",
66
themeConfig: {
77
nav: nav(),
8+
sidebar: sidebar(),
89
},
910
})
1011

@@ -17,3 +18,15 @@ function nav(): DefaultTheme.NavItem[] {
1718
},
1819
]
1920
}
21+
22+
function sidebar(): DefaultTheme.Sidebar {
23+
return [
24+
{
25+
text: "案例",
26+
items: [
27+
{ text: "Markdown 案例", link: "/zh-CN/markdown-examples" },
28+
{ text: "运行时 API 案例", link: "/zh-CN/api-examples" },
29+
],
30+
},
31+
]
32+
}

0 commit comments

Comments
 (0)