Skip to content

Commit

Permalink
add: i18n support for config(including nav)
Browse files Browse the repository at this point in the history
  • Loading branch information
Purple-CSGO committed Dec 19, 2023
1 parent 7070f6f commit 55b041e
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 15 deletions.
63 changes: 49 additions & 14 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ export default defineConfig({
},
],
],
locales: {
root: {
label: "English",
lang: "en",
},
"zh-hans": {
label: "简体中文",
lang: "zh-hans",
link: "/zh-hans/",
},
},
lastUpdated: true,
cleanUrls: true,

Expand All @@ -51,6 +40,7 @@ export default defineConfig({
],

// @ts-ignore
// https://github.com/jooy2/vitepress-sidebar
sidebar: generateSidebar([
{
documentRootPath: "/docs",
Expand All @@ -60,8 +50,7 @@ export default defineConfig({
useTitleFromFileHeading: false,
sortMenusByFrontmatterOrder: true,
useFolderTitleFromIndexFile: true,
collapsed: true,
rootGroupCollapsed: false,
collapsed: false,
collapseDepth: 2,
// ignore other language folders
excludeFolders: ["zh-hans", "zh-hant"],
Expand All @@ -75,13 +64,14 @@ export default defineConfig({
sortMenusByFrontmatterOrder: true,
useFolderTitleFromIndexFile: true,
collapsed: true,
rootGroupCollapsed: false,
collapseDepth: 2,
},
// NOTE: Add more language support
]),

socialLinks: [
{ icon: "github", link: "https://github.com/advancedfx/advancedfx" },
{ icon: "discord", link: "https://discord.gg/e7sgYQcR" },
],

search: {
Expand All @@ -108,11 +98,56 @@ export default defineConfig({
},
},
},
// NOTE: Add more language support
// "zh-hant": {},
},
},
},
},

// i18n
locales: {
root: {
label: "English",
lang: "en",
},

// Override Config for Chinese Simplified locale
"zh-hans": {
label: "简体中文",
lang: "zh-hans",
link: "/zh-hans/",
title: "Advancedfx",
description:
"Half-Life Advanced Effects (HLAE) is a tool to enrich Source (mainly CS:GO) engine based movie making.",
themeConfig: {
lastUpdated: {
text: "上次更新",
},
editLink: {
pattern: "https://github.com/advancedfx/afx-doc/master/docs/:path",
text: "在 GitHub 上编辑此页",
},
footer: {
message: "Made with ❤️ by Advancedfx",
copyright: "Copyright © 2023-present xxx",
},
nav: [
{ text: "指南", link: "/guides/" },
{ text: "教程", link: "/tutorials/" },
{ text: "常见问题", link: "/faq/" },
{ text: "博客", link: "/blog/" },
{ text: "发布", link: "/releases/" },
{ text: "下载", link: "/" }, // TODO: link to download #
],
},
},

// NOTE: Add more language support

// Override Config for Chinese Traditional locale
// "zh-hant": {},
},

vite: {},
});
5 changes: 5 additions & 0 deletions docs/blog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar: false
title: Blog
order: 50
---
5 changes: 5 additions & 0 deletions docs/blog/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Start up
---

# New afx-doc site~
2 changes: 1 addition & 1 deletion docs/guides/faq/index.md → docs/faq/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
order: 9999
title: FAQ
order: 30
---
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/guides/AfxHookSource2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: AfxHookSource2
---
# The main file
5 changes: 5 additions & 0 deletions docs/guides/AfxHookSource2/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Intro
order: 10
---
# Counter Strike 2
1 change: 1 addition & 0 deletions docs/guides/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
title: Guide
order: 10
---
# The main file
4 changes: 4 additions & 0 deletions docs/releases/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Releases
order: 40
---
5 changes: 5 additions & 0 deletions docs/releases/v0.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: v0.0.0
---

# v0.0.0
5 changes: 5 additions & 0 deletions docs/releases/v0.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: v0.0.1
---

# v0.0.1
1 change: 1 addition & 0 deletions docs/tutorials/demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Demo
6 changes: 6 additions & 0 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Tutorials
order: 20
---

# Tutorials

0 comments on commit 55b041e

Please sign in to comment.