Skip to content

Commit

Permalink
feat: add Chinese docs translation (#2552)
Browse files Browse the repository at this point in the history
* 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]>
3 people authored Dec 5, 2024

Verified

This commit was signed with the committer’s verified signature.
JonGilmore Jon Gilmore
1 parent 7c55128 commit 3640951
Showing 32 changed files with 6,558 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docs/.vitepress/config/index.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { enConfig } from './en.mts'
import { frConfig } from './fr.mts'
import { zhConfig } from './zh.mts'
import { sharedConfig } from './shared.mts'
import { defineConfig } from 'vitepress'

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

locales: {
root: { label: 'English', lang: 'en-US', link: '/', ...enConfig },
fr: { label: 'Français', lang: 'fr-FR', link: '/fr/', ...frConfig },
fr: { label: 'Français', lang: 'fr-FR', link: '/fr/', ...frConfig },
zh: { label: '简体中文 (校对中)', lang: 'zh-CN', link: '/zh/', ...zhConfig }
}
})
154 changes: 154 additions & 0 deletions docs/.vitepress/config/zh.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'

export const META_URL = ''
export const META_TITLE = 'Vue Test Utils'
export const META_DESCRIPTION = 'Vue.js 3 官方测试工具集'

export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
description: META_DESCRIPTION,
head: [
['meta', { property: 'og:url', content: META_URL }],
['meta', { property: 'og:title', content: META_TITLE }],
['meta', { property: 'og:description', content: META_DESCRIPTION }],
['meta', { property: 'twitter:url', content: META_URL }],
['meta', { property: 'twitter:title', content: META_TITLE }],
['meta', { property: 'twitter:description', content: META_DESCRIPTION }]
],

themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/test-utils/edit/main/docs/:path',
text: '改进此页面的内容'
},

nav: [
{ text: '指南', link: '/zh/guide/' },
{ text: 'API 参考', link: '/zh/api/' },
{ text: '从 Vue 2 迁移', link: '/zh/migration/' },
{
text: '更新日志',
link: 'https://github.com/vuejs/test-utils/releases'
}
],

sidebar: {
'/zh': [
{
text: '安装',
link: '/zh/installation/'
},
{
text: '基础知识',
items: [
{
text: '开始',
link: '/zh/guide/'
},
{
text: '快速上手',
link: '/zh/guide/essentials/a-crash-course'
},
{
text: '条件渲染',
link: '/zh/guide/essentials/conditional-rendering'
},
{
text: '测试事件触发',
link: '/zh/guide/essentials/event-handling'
},
{
text: '测试表单',
link: '/zh/guide/essentials/forms'
},
{
text: '传递数据到组件',
link: '/zh/guide/essentials/passing-data'
},
{
text: '编写易于测试的组件',
link: '/zh/guide/essentials/easy-to-test'
}
]
},
{
text: '深入学习 Vue Test Utils',
items: [
{
text: '插槽',
link: '/zh/guide/advanced/slots'
},
{
text: '异步行为',
link: '/zh/guide/advanced/async-suspense'
},
{
text: '发起 HTTP 请求',
link: '/zh/guide/advanced/http-requests'
},
{
text: '过渡效果',
link: '/zh/guide/advanced/transitions'
},
{
text: '组件实例',
link: '/zh/guide/advanced/component-instance'
},
{
text: '复用与组合',
link: '/zh/guide/advanced/reusability-composition'
},
{
text: '测试 v-model',
link: '/zh/guide/advanced/v-model'
},
{
text: '测试 Vuex',
link: '/zh/guide/advanced/vuex'
},
{
text: '测试 Vue Router',
link: '/zh/guide/advanced/vue-router'
},
{
text: '测试 Teleport',
link: '/zh/guide/advanced/teleport'
},
{
text: 'Stubs 和浅挂载',
link: '/zh/guide/advanced/stubs-shallow-mount'
},
{
text: '测试服务端渲染',
link: '/zh/guide/advanced/ssr'
}
]
},
{
text: '扩展 Vue Test Utils',
items: [
{
text: '插件',
link: '/zh/guide/extending-vtu/plugins'
},
{
text: '社区与学习资源',
link: '/zh/guide/extending-vtu/community-learning'
}
]
},
{
text: '常见问题',
link: '/zh/guide/faq/'
},
{
text: '从 Vue 2 迁移',
link: '/zh/migration/'
},
{
text: 'API 参考',
link: '/zh/api/'
}
]
}
}
}
1 change: 1 addition & 0 deletions docs/.vitepress/theme/index.mts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import status from '../translation-status.json'
import './custom.css'
const i18nLabels = {
fr: 'La traduction est synchronisée avec les docs du ${date} dont le hash du commit est <code>${hash}</code>.',
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>'
}


4 changes: 4 additions & 0 deletions docs/.vitepress/translation-status.json
Original file line number Diff line number Diff line change
@@ -2,5 +2,9 @@
"fr": {
"hash": "644917a",
"date": "2024-05-28"
},
"zh": {
"hash": "7c55128",
"date": "2024-11-28"
}
}
Loading

0 comments on commit 3640951

Please sign in to comment.