Skip to content

Commit 3640951

Browse files
DDDDD12138Jinjiangveaba
authored
feat: add Chinese docs translation (#2552)
* feat: add zh config * feat: add zh template (copied from English) * feat: complete all Chinese translations * feat: add zh i18nLabels * chore(docs): upgrade translation helper * feat: Use zhlint to lint markdown files * chore: remove zh README.md file * feat: correct pronoun usage * feat: update translation status * feat: remove spaces around dashes * feat: update zh i18nLabel Co-authored-by: Jinjiang <[email protected]> * feat: remove spaces around full-width symbol links * feat: format Markdown italic syntax * feat: update zh description Co-authored-by: veaba <[email protected]> * feat: update Co-authored-by: veaba <[email protected]> Co-authored-by: Jinjiang <[email protected]> * docs(zh-cn): add in-review label and call for participation --------- Co-authored-by: Jinjiang <[email protected]> Co-authored-by: veaba <[email protected]>
1 parent 7c55128 commit 3640951

32 files changed

+6558
-7
lines changed

docs/.vitepress/config/index.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { enConfig } from './en.mts'
22
import { frConfig } from './fr.mts'
3+
import { zhConfig } from './zh.mts'
34
import { sharedConfig } from './shared.mts'
45
import { defineConfig } from 'vitepress'
56

@@ -8,6 +9,7 @@ export default defineConfig({
89

910
locales: {
1011
root: { label: 'English', lang: 'en-US', link: '/', ...enConfig },
11-
fr: { label: 'Français', lang: 'fr-FR', link: '/fr/', ...frConfig },
12+
fr: { label: 'Français', lang: 'fr-FR', link: '/fr/', ...frConfig },
13+
zh: { label: '简体中文 (校对中)', lang: 'zh-CN', link: '/zh/', ...zhConfig }
1214
}
1315
})

docs/.vitepress/config/zh.mts

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
2+
3+
export const META_URL = ''
4+
export const META_TITLE = 'Vue Test Utils'
5+
export const META_DESCRIPTION = 'Vue.js 3 官方测试工具集'
6+
7+
export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
8+
description: META_DESCRIPTION,
9+
head: [
10+
['meta', { property: 'og:url', content: META_URL }],
11+
['meta', { property: 'og:title', content: META_TITLE }],
12+
['meta', { property: 'og:description', content: META_DESCRIPTION }],
13+
['meta', { property: 'twitter:url', content: META_URL }],
14+
['meta', { property: 'twitter:title', content: META_TITLE }],
15+
['meta', { property: 'twitter:description', content: META_DESCRIPTION }]
16+
],
17+
18+
themeConfig: {
19+
editLink: {
20+
pattern: 'https://github.com/vuejs/test-utils/edit/main/docs/:path',
21+
text: '改进此页面的内容'
22+
},
23+
24+
nav: [
25+
{ text: '指南', link: '/zh/guide/' },
26+
{ text: 'API 参考', link: '/zh/api/' },
27+
{ text: '从 Vue 2 迁移', link: '/zh/migration/' },
28+
{
29+
text: '更新日志',
30+
link: 'https://github.com/vuejs/test-utils/releases'
31+
}
32+
],
33+
34+
sidebar: {
35+
'/zh': [
36+
{
37+
text: '安装',
38+
link: '/zh/installation/'
39+
},
40+
{
41+
text: '基础知识',
42+
items: [
43+
{
44+
text: '开始',
45+
link: '/zh/guide/'
46+
},
47+
{
48+
text: '快速上手',
49+
link: '/zh/guide/essentials/a-crash-course'
50+
},
51+
{
52+
text: '条件渲染',
53+
link: '/zh/guide/essentials/conditional-rendering'
54+
},
55+
{
56+
text: '测试事件触发',
57+
link: '/zh/guide/essentials/event-handling'
58+
},
59+
{
60+
text: '测试表单',
61+
link: '/zh/guide/essentials/forms'
62+
},
63+
{
64+
text: '传递数据到组件',
65+
link: '/zh/guide/essentials/passing-data'
66+
},
67+
{
68+
text: '编写易于测试的组件',
69+
link: '/zh/guide/essentials/easy-to-test'
70+
}
71+
]
72+
},
73+
{
74+
text: '深入学习 Vue Test Utils',
75+
items: [
76+
{
77+
text: '插槽',
78+
link: '/zh/guide/advanced/slots'
79+
},
80+
{
81+
text: '异步行为',
82+
link: '/zh/guide/advanced/async-suspense'
83+
},
84+
{
85+
text: '发起 HTTP 请求',
86+
link: '/zh/guide/advanced/http-requests'
87+
},
88+
{
89+
text: '过渡效果',
90+
link: '/zh/guide/advanced/transitions'
91+
},
92+
{
93+
text: '组件实例',
94+
link: '/zh/guide/advanced/component-instance'
95+
},
96+
{
97+
text: '复用与组合',
98+
link: '/zh/guide/advanced/reusability-composition'
99+
},
100+
{
101+
text: '测试 v-model',
102+
link: '/zh/guide/advanced/v-model'
103+
},
104+
{
105+
text: '测试 Vuex',
106+
link: '/zh/guide/advanced/vuex'
107+
},
108+
{
109+
text: '测试 Vue Router',
110+
link: '/zh/guide/advanced/vue-router'
111+
},
112+
{
113+
text: '测试 Teleport',
114+
link: '/zh/guide/advanced/teleport'
115+
},
116+
{
117+
text: 'Stubs 和浅挂载',
118+
link: '/zh/guide/advanced/stubs-shallow-mount'
119+
},
120+
{
121+
text: '测试服务端渲染',
122+
link: '/zh/guide/advanced/ssr'
123+
}
124+
]
125+
},
126+
{
127+
text: '扩展 Vue Test Utils',
128+
items: [
129+
{
130+
text: '插件',
131+
link: '/zh/guide/extending-vtu/plugins'
132+
},
133+
{
134+
text: '社区与学习资源',
135+
link: '/zh/guide/extending-vtu/community-learning'
136+
}
137+
]
138+
},
139+
{
140+
text: '常见问题',
141+
link: '/zh/guide/faq/'
142+
},
143+
{
144+
text: '从 Vue 2 迁移',
145+
link: '/zh/migration/'
146+
},
147+
{
148+
text: 'API 参考',
149+
link: '/zh/api/'
150+
}
151+
]
152+
}
153+
}
154+
}

docs/.vitepress/theme/index.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import status from '../translation-status.json'
55
import './custom.css'
66
const i18nLabels = {
77
fr: 'La traduction est synchronisée avec les docs du ${date} dont le hash du commit est <code>${hash}</code>.',
8+
zh: '该翻译已同步到了 ${date} 的版本,其对应的 commit hash 是 <code>${hash}</code>。<br /><mark>同时该文档仍处于校对中,如有任何疑问或想参与校对工作,请<a href="https://github.com/vuejs/test-utils/issues/2561" target="_blank" style="font-weight: bold; text-decoration: underline;">移步这里</a>了解更多。</mark>'
89
}
910

1011

docs/.vitepress/translation-status.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"fr": {
33
"hash": "644917a",
44
"date": "2024-05-28"
5+
},
6+
"zh": {
7+
"hash": "7c55128",
8+
"date": "2024-11-28"
59
}
610
}

0 commit comments

Comments
 (0)