Skip to content

Commit 44172dc

Browse files
authored
Adds translate support (#815)
* Adds translate support * ci: 优化翻译文档工作流,移除冗余依赖安装步骤 * 修正文档路径中的语言代码分隔符,从 'zh-CN' 更改为 'zh_CN' * 恢复对繁体中文和香港中文的支持,更新文档翻译配置 * Update docs and translate * Revert "Update docs and translate" This reverts commit 25604d79546cae30dee2bbb63eee2fef44c78639. * 新增简体中文文档,包含常见问题、入门指南、组件说明及相关支持文档 * 新增简体中文、繁体中文和台湾中文的配置和导航文件,删除旧的中文文件 * Update docs and translate * 更新配置文件,新增简体中文、繁体中文(港)、繁体中文(台)支持,并恢复英文配置 * 更新繁体中文(港)和繁体中文(台)文档链接,确保导航和组件链接指向正确的语言版本 * 更新文档翻译工作流,排除主分支的推送触发 * 更新文档翻译工作流,仅在文档目录下的更改时触发 * 更新文档翻译工作流,移除对主分支的推送触发限制 * 重构文档工作流,合并翻译和拆分功能,移除旧的工作流配置 --------- Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-authored-by: huangdijia <huangdijia@users.noreply.github.com>
1 parent ce04ed5 commit 44172dc

176 files changed

Lines changed: 9228 additions & 96 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vitepress/config.mts

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
import { defineConfig } from 'vitepress'
2+
23
import enGetConfig from "./src/en/config";
34
import enGetNavs from "./src/en/nav";
45
import enGetSidebar from "./src/en/sidebars";
5-
import zhGetConfig from "./src/zh/config";
6-
import zhGetNavs from "./src/zh/nav";
7-
import zhGetSidebar from "./src/zh/sidebars";
6+
7+
import cnGetConfig from "./src/zh-cn/config";
8+
import cnGetNavs from "./src/zh-cn/nav";
9+
import cnGetSidebar from "./src/zh-cn/sidebars";
10+
11+
import hkGetConfig from "./src/zh-hk/config";
12+
import hkGetNavs from "./src/zh-hk/nav";
13+
import hkGetSidebar from "./src/zh-hk/sidebars";
14+
15+
import twGetConfig from "./src/zh-tw/config";
16+
import twGetNavs from "./src/zh-tw/nav";
17+
import twGetSidebar from "./src/zh-tw/sidebars";
18+
819
import taskLists from 'markdown-it-task-lists'
920

1021
// https://vitepress.dev/reference/site-config
@@ -40,9 +51,37 @@ export default defineConfig({
4051
],
4152
locales:{
4253
root:{
43-
label:"中文",
54+
label:"简体中文",
4455
lang:"zh",
45-
...zhGetConfig,
56+
...cnGetConfig,
57+
},
58+
"zh-hk":{
59+
label:"繁體中文(港)",
60+
lang:"zh-hk",
61+
link:"/zh-hk/index",
62+
...hkGetConfig,
63+
themeConfig:{
64+
logo: '/logo.svg',
65+
nav: hkGetNavs,
66+
sidebar:hkGetSidebar,
67+
outline:{
68+
level:[2 ,4],
69+
},
70+
}
71+
},
72+
"zh-tw":{
73+
label:"繁體中文(臺)",
74+
lang:"zh-tw",
75+
link:"/zh-tw/index",
76+
...twGetConfig,
77+
themeConfig:{
78+
logo: '/logo.svg',
79+
nav: twGetNavs,
80+
sidebar:twGetSidebar,
81+
outline:{
82+
level:[2 ,4],
83+
},
84+
}
4685
},
4786
en:{
4887
label:"English",
@@ -128,9 +167,9 @@ export default defineConfig({
128167
i18nRouting:false,
129168
// https://vitepress.dev/reference/default-theme-config
130169

131-
nav: zhGetNavs,
170+
nav: cnGetNavs,
132171

133-
sidebar: zhGetSidebar,
172+
sidebar: cnGetSidebar,
134173

135174
socialLinks: [
136175
{ icon: 'github', link: 'https://github.com/friendsofhyperf/components' },
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import {DefaultTheme} from "vitepress";
22

33
const nav:DefaultTheme.NavItem[] = [
4-
// { text: '入门', link: '/zh_CN/guide/' },
5-
{ text: '组件', link: '/zh_CN/components/' },
6-
{ text: 'FAQ', link: '/zh_CN/faq/index' },
4+
{ text: '组件', link: '/zh-cn/components/' },
5+
{ text: 'FAQ', link: '/zh-cn/faq/index' },
76
{ text: '更多', items:[
87
{ text: 'Hyperf', link: 'https://hyperf.wiki/' },
98
{ text: 'MineAdmin', link: 'https://www.mineadmin.com/' }
Lines changed: 53 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,218 @@
11
import {DefaultTheme} from "vitepress";
22

33
const sidebar:DefaultTheme.Sidebar = {
4-
// '/zh_CN/guide/': [
5-
// {
6-
// text: '介绍',
7-
// items: [
8-
// {
9-
// text: '关于 FriendsOfHyperf',
10-
// link: '/zh_CN/guide/introduce/about',
11-
// },
12-
// ]
13-
// },
14-
// {
15-
// text: '快速开始',
16-
// items: [
17-
// {
18-
// text: "支持的组件列表",
19-
// link: "/zh_CN/guide/start/components"
20-
// }
21-
// ]
22-
// }
23-
// ],
24-
'/zh_CN/faq/':[{
4+
'/zh-cn/faq/':[{
255
text: '常见问题',
266
items: [
277
{
288
text: '关于 FriendsOfHyperf',
29-
link: '/zh_CN/faq/about'
9+
link: '/zh-cn/faq/about'
3010
},
3111
{
3212
text: '如何使用',
33-
link: '/zh_CN/faq/how-to-use'
13+
link: '/zh-cn/faq/how-to-use'
3414
}
3515
]
3616
}],
37-
'/zh_CN/components/':[
17+
'/zh-cn/components/':[
3818
{
3919
text: '组件',
4020
items: [
4121
{
4222
text: 'Amqp Job',
43-
link: '/zh_CN/components/amqp-job.md'
23+
link: '/zh-cn/components/amqp-job.md'
4424
},
4525
{
4626
text: 'Cache',
47-
link: '/zh_CN/components/cache.md'
27+
link: '/zh-cn/components/cache.md'
4828
},
4929
{
5030
text: 'Command Signals',
51-
link: '/zh_CN/components/command-signals.md'
31+
link: '/zh-cn/components/command-signals.md'
5232
},
5333
{
5434
text: 'Command Validation',
55-
link: '/zh_CN/components/command-validation.md'
35+
link: '/zh-cn/components/command-validation.md'
5636
},
5737
{
5838
text: 'Compoships',
59-
link: '/zh_CN/components/compoships.md'
39+
link: '/zh-cn/components/compoships.md'
6040
},
6141
{
6242
text: 'Confd',
63-
link: '/zh_CN/components/confd.md'
43+
link: '/zh-cn/components/confd.md'
6444
},
6545
{
6646
text: 'Config Consul',
67-
link: '/zh_CN/components/config-consul.md'
47+
link: '/zh-cn/components/config-consul.md'
6848
},
6949
{
7050
text: 'Console Spinner',
71-
link: '/zh_CN/components/console-spinner.md'
51+
link: '/zh-cn/components/console-spinner.md'
7252
},
7353
{
7454
text: 'Di Plus',
75-
link: '/zh_CN/components/di-plus.md'
55+
link: '/zh-cn/components/di-plus.md'
7656
},
7757
{
7858
text: 'Elasticsearch',
79-
link: '/zh_CN/components/elasticsearch.md'
59+
link: '/zh-cn/components/elasticsearch.md'
8060
},
8161
{
8262
text: 'Encryption',
83-
link: '/zh_CN/components/encryption.md'
63+
link: '/zh-cn/components/encryption.md'
8464
},
8565
{
8666
text: 'Exception Event',
87-
link: '/zh_CN/components/exception-event.md'
67+
link: '/zh-cn/components/exception-event.md'
8868
},
8969
{
9070
text: 'Facade',
91-
link: '/zh_CN/components/facade.md'
71+
link: '/zh-cn/components/facade.md'
9272
},
9373
{
9474
text: 'Fast Paginate',
95-
link: '/zh_CN/components/fast-paginate.md'
75+
link: '/zh-cn/components/fast-paginate.md'
9676
},
9777
{
9878
text: 'Grpc Validation',
99-
link: '/zh_CN/components/grpc-validation.md'
79+
link: '/zh-cn/components/grpc-validation.md'
10080
},
10181
{
10282
text: 'Helpers',
103-
link: '/zh_CN/components/helpers.md'
83+
link: '/zh-cn/components/helpers.md'
10484
},
10585
{
10686
text: 'Http Client',
107-
link: '/zh_CN/components/http-client.md'
87+
link: '/zh-cn/components/http-client.md'
10888
},
10989
{
11090
text: 'Http Logger',
111-
link: '/zh_CN/components/http-logger.md'
91+
link: '/zh-cn/components/http-logger.md'
11292
},
11393
{
11494
text: 'Ide Helper',
115-
link: '/zh_CN/components/ide-helper.md'
95+
link: '/zh-cn/components/ide-helper.md'
11696
},
11797
{
11898
text: 'Ipc Broadcaster',
119-
link: '/zh_CN/components/ipc-broadcaster.md'
99+
link: '/zh-cn/components/ipc-broadcaster.md'
120100
},
121101
{
122102
text: 'Lock',
123-
link: '/zh_CN/components/lock.md'
103+
link: '/zh-cn/components/lock.md'
124104
},
125105
{
126106
text: 'Macros',
127-
link: '/zh_CN/components/macros.md'
107+
link: '/zh-cn/components/macros.md'
128108
},
129109
{
130110
text: 'Mail',
131-
link: '/zh_CN/components/mail.md'
111+
link: '/zh-cn/components/mail.md'
132112
},
133113
{
134114
text: 'Middleware Plus',
135-
link: '/zh_CN/components/middleware-plus.md'
115+
link: '/zh-cn/components/middleware-plus.md'
136116
},
137117
{
138118
text: 'Model Factory',
139-
link: '/zh_CN/components/model-factory.md'
119+
link: '/zh-cn/components/model-factory.md'
140120
},
141121
{
142122
text: 'Model Hashids',
143-
link: '/zh_CN/components/model-hashids.md'
123+
link: '/zh-cn/components/model-hashids.md'
144124
},
145125
{
146126
text: 'Model Morph Addon',
147-
link: '/zh_CN/components/model-morph-addon.md'
127+
link: '/zh-cn/components/model-morph-addon.md'
148128
},
149129
{
150130
text: 'Model Observer',
151-
link: '/zh_CN/components/model-observer.md'
131+
link: '/zh-cn/components/model-observer.md'
152132
},
153133
{
154134
text: 'Model Scope',
155-
link: '/zh_CN/components/model-scope.md'
135+
link: '/zh-cn/components/model-scope.md'
156136
},
157137
{
158138
text: 'Monolog Hook',
159-
link: '/zh_CN/components/monolog-hook.md'
139+
link: '/zh-cn/components/monolog-hook.md'
160140
},
161141
{
162142
text: 'Mysql Grammar Addon',
163-
link: '/zh_CN/components/mysql-grammar-addon.md'
143+
link: '/zh-cn/components/mysql-grammar-addon.md'
164144
},
165145
{
166146
text: 'Notification',
167-
link: '/zh_CN/components/notification.md'
147+
link: '/zh-cn/components/notification.md'
168148
},
169149
{
170150
text: 'Notification Easysms',
171-
link: '/zh_CN/components/notification-easysms.md'
151+
link: '/zh-cn/components/notification-easysms.md'
172152
},
173153
{
174154
text: 'Notification Mail',
175-
link: '/zh_CN/components/notification-mail.md'
155+
link: '/zh-cn/components/notification-mail.md'
176156
},
177157
{
178158
text: 'OpenAI Client',
179-
link: '/zh_CN/components/openai-client.md'
159+
link: '/zh-cn/components/openai-client.md'
180160
},
181161
{
182162
text: 'Pest Plugin Hyperf',
183-
link: '/zh_CN/components/pest-plugin-hyperf.md'
163+
link: '/zh-cn/components/pest-plugin-hyperf.md'
184164
},
185165
{
186166
text: 'Pretty Console',
187-
link: '/zh_CN/components/pretty-console.md'
167+
link: '/zh-cn/components/pretty-console.md'
188168
},
189169
{
190170
text: 'Purifier',
191-
link: '/zh_CN/components/purifier.md'
171+
link: '/zh-cn/components/purifier.md'
192172
},
193173
{
194174
text: 'Recaptcha',
195-
link: '/zh_CN/components/recaptcha.md'
175+
link: '/zh-cn/components/recaptcha.md'
196176
},
197177
{
198178
text: 'Redis Subscriber',
199-
link: '/zh_CN/components/redis-subscriber.md'
179+
link: '/zh-cn/components/redis-subscriber.md'
200180
},
201181
{
202182
text: 'Sentry',
203-
link: '/zh_CN/components/sentry.md'
183+
link: '/zh-cn/components/sentry.md'
204184
},
205185
{
206186
text: 'Support',
207-
link: '/zh_CN/components/support.md'
187+
link: '/zh-cn/components/support.md'
208188
},
209189
{
210190
text: 'Tcp Sender',
211-
link: '/zh_CN/components/tcp-sender.md'
191+
link: '/zh-cn/components/tcp-sender.md'
212192
},
213193
{
214194
text: 'Telescope',
215-
link: '/zh_CN/components/telescope.md'
195+
link: '/zh-cn/components/telescope.md'
216196
},
217197
{
218198
text: 'Telescope Elasticsearch Driver',
219-
link: '/zh_CN/components/telescope-elasticsearch.md'
199+
link: '/zh-cn/components/telescope-elasticsearch.md'
220200
},
221201
{
222202
text: 'Tinker',
223-
link: '/zh_CN/components/tinker.md'
203+
link: '/zh-cn/components/tinker.md'
224204
},
225205
{
226206
text: 'Trigger',
227-
link: '/zh_CN/components/trigger.md'
207+
link: '/zh-cn/components/trigger.md'
228208
},
229209
{
230210
text: 'Validated DTO',
231-
link: '/zh_CN/components/validated-dto.md'
211+
link: '/zh-cn/components/validated-dto.md'
232212
},
233213
{
234214
text: 'Web Tinker',
235-
link: '/zh_CN/components/web-tinker.md'
215+
link: '/zh-cn/components/web-tinker.md'
236216
}
237217
]
238218
}

.vitepress/src/zh-hk/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
title: "FriendsOfHyperf",
3+
description: "🚀 最受歡迎的 Hyperf 組件。",
4+
tagline: "Hyperf 組件",
5+
}

0 commit comments

Comments
 (0)