Skip to content

Commit a44d9ed

Browse files
committed
feat: configure internationalisation for navbar and sidebar
1 parent 06cc9ac commit a44d9ed

File tree

6 files changed

+63
-23
lines changed

6 files changed

+63
-23
lines changed

docs/.vitepress/config.mts

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
11
import { defineConfig } from "vitepress"
2+
import { shared } from "./shared"
23

34
// https://vitepress.dev/reference/site-config
45
export default defineConfig({
5-
title: "OnixByte",
6-
description: "OnixByte Official Site",
7-
themeConfig: {
8-
// https://vitepress.dev/reference/default-theme-config
9-
nav: [
10-
{ text: "Home", link: "/" },
11-
{ text: "Examples", link: "/markdown-examples" },
12-
],
13-
sidebar: [
14-
{
15-
text: "Examples",
16-
items: [
17-
{ text: "Markdown Examples", link: "/markdown-examples" },
18-
{ text: "Runtime API Examples", link: "/api-examples" },
19-
],
20-
},
21-
],
22-
socialLinks: [
23-
{ icon: "github", link: "https://github.com/onixbyte-opensource" },
24-
],
25-
},
6+
...shared,
267
locales: {
278
root: {
289
label: "English (Great Britain)",

docs/.vitepress/en-GB.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { DefaultTheme, defineConfig } from "vitepress"
2+
3+
export const enGB = defineConfig({
4+
lang: "en-GB",
5+
description: "A non-profit open source developer organisation.",
6+
themeConfig: {
7+
nav: nav(),
8+
},
9+
})
10+
11+
function nav(): DefaultTheme.NavItem[] {
12+
return [
13+
{
14+
text: "Home",
15+
link: "/",
16+
activeMatch: "/",
17+
},
18+
]
19+
}

docs/.vitepress/shared.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig } from "vitepress"
2+
3+
export const shared = defineConfig({
4+
title: "OnixByte",
5+
description: "OnixByte Official Site",
6+
themeConfig: {
7+
// 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+
],
17+
socialLinks: [
18+
{ icon: "github", link: "https://github.com/onixbyte-opensource" },
19+
],
20+
},
21+
})

docs/.vitepress/zh-CN.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { DefaultTheme, defineConfig } from "vitepress"
2+
3+
export const zhCN = defineConfig({
4+
lang: "zh-CN",
5+
description: "一个非营利性开源开发者组织。",
6+
themeConfig: {
7+
nav: nav(),
8+
},
9+
})
10+
11+
function nav(): DefaultTheme.NavItem[] {
12+
return [
13+
{
14+
text: "主页",
15+
link: "/",
16+
activeMatch: "/",
17+
},
18+
]
19+
}

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: home
44

55
hero:
66
name: "OnixByte"
7-
tagline: My great project tagline
7+
tagline: A non-profit open source developer organisation.
88
actions:
99
- theme: brand
1010
text: Markdown Examples

docs/zh-CN/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: home
44

55
hero:
66
name: "OnixByte"
7-
tagline: OnixByte 官方网站
7+
tagline: 一个非营利性开源开发者组织。
88
actions:
99
- theme: brand
1010
text: Markdown 示例

0 commit comments

Comments
 (0)