Skip to content

Commit

Permalink
docs(zh_CN): add Chinese documentation for FriendsOfHyperf (#756)
Browse files Browse the repository at this point in the history
* docs(zh_CN): add Chinese documentation for FriendsOfHyperf

- Create new documentation files for Amqp Job and Cache components
- Add guide, reference, and FAQ sections in Chinese
- Set up navigation and sidebar menus for Chinese documentation
- Configure VitePress for multi-language support

* fix
  • Loading branch information
zds-s authored Nov 27, 2024
1 parent cdfbbb6 commit 827140b
Show file tree
Hide file tree
Showing 14 changed files with 357 additions and 14 deletions.
103 changes: 89 additions & 14 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,28 +1,103 @@
import { defineConfig } from 'vitepress'
import enGetNavs from "./src/en/nav";
import zhGetNavs from "./src/zh/nav";
import enGetConfig from "./src/en/config";
import zhGetConfig from "./src/zh/config";
import zhGetSidebar from "./src/zh/sidebars";
import enGetSidebar from "./src/en/sidebars";

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "FriendsOfHyperf",
description: "A Hyperf component",
ignoreDeadLinks: true,
locales:{
root:{
label:"中文",
lang:"zh",
...zhGetConfig,
},
en:{
label:"English",
lang:"en",
link:"/en/index",
...enGetConfig,
themeConfig:{
logo: '/logo.svg',
nav: enGetNavs,
sidebar:enGetSidebar,
outline:{
level:[2 ,4],
},
}
}
},
themeConfig: {
outline:{
label: '页面导航',
level: [2, 4],
},
editLink: {
pattern: 'https://github.com/friendsofhyperf/components/edit/main/docs/:path',
text: '在Github上编辑此页面',
},
lastUpdated: {
text: '最后更新于',
},
docFooter: {
next: '下一页',
prev: '上一页',
},
sidebarMenuLabel: '菜单',
returnToTopLabel: '回到顶部',
search:{
provider:"local",
options:{
locales: {
zh: {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换'
}
}
}
},
en: {
translations: {
button: {
buttonText: 'Search documents',
buttonAriaLabel: 'Search documents'
},
modal: {
noResultsText: 'No relevant results found',
resetButtonTitle: 'Clear query conditions',
footer: {
selectText: 'Select',
navigateText: 'Switch'
}
}
}
}
}
}
},
i18nRouting:false,
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' }
],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' }
]
}
],
nav: zhGetNavs,

sidebar: zhGetSidebar,

socialLinks: [
{ icon: 'github', link: 'https://github.com/friendsofhyperf/components' }
{ icon: 'github', link: 'https://github.com/friendsofhyperf/components' },
]
}
})
5 changes: 5 additions & 0 deletions .vitepress/src/en/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
title: "FriendsOfHyperf",
description: "A Hyperf component",
tagline: "Hyperf component",
}
9 changes: 9 additions & 0 deletions .vitepress/src/en/nav.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {DefaultTheme} from "vitepress";

const nav:DefaultTheme.NavItem[] = [
{ text: '指南', link: '/zh/guide/' },
{ text: '参考', link: '/zh/reference/' },
{ text: '常见问题', link: '/zh/faq/index' }
]

export default nav
26 changes: 26 additions & 0 deletions .vitepress/src/en/sidebars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {DefaultTheme} from "vitepress";

const sidebar:DefaultTheme.Sidebar = {
'/zh/guide/': [
{
text: '介绍',
items: [
{
text: '关于 FriendsOfHyperf',
link: '/zh_CN/guide/introduce/about',
},
]
},
{
text: '开始',
items: [
{
text: "组件列表",
link: "/zh_CN/guide/start/components"
}
]
}
]
}

export default sidebar
5 changes: 5 additions & 0 deletions .vitepress/src/zh/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
title: "FriendsOfHyperf",
description: "A Hyperf component",
tagline: "Hyperf component",
}
9 changes: 9 additions & 0 deletions .vitepress/src/zh/nav.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {DefaultTheme} from "vitepress";

const nav:DefaultTheme.NavItem[] = [
{ text: '指南', link: '/zh_CN/guide/' },
{ text: '参考', link: '/zh_CN/reference/' },
{ text: '常见问题', link: '/zh_CN/faq/index' }
]

export default nav
36 changes: 36 additions & 0 deletions .vitepress/src/zh/sidebars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {DefaultTheme} from "vitepress";

const sidebar:DefaultTheme.Sidebar = {
'/zh_CN/guide/': [
{
text: '介绍',
items: [
{
text: '关于 FriendsOfHyperf',
link: '/zh_CN/guide/introduce/about',
},
]
},
{
text: '开始',
items: [
{
text: "支持的组件列表",
link: "/zh_CN/guide/start/components"
}
]
}
],
'/zh_CN/reference/':[
{
text: 'Amqp Job',
link: '/zh_CN/reference/amqp-job'
},
{
text: 'Cache',
link: '/zh_CN/reference/cache'
}
]
}

export default sidebar
1 change: 1 addition & 0 deletions zh_CN/faq/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 常见问题
1 change: 1 addition & 0 deletions zh_CN/guide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 指南
1 change: 1 addition & 0 deletions zh_CN/guide/introduce/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 关于 FriendsOfHyperf
Loading

0 comments on commit 827140b

Please sign in to comment.