Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Chinese docs translation #2552

Merged
merged 17 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'

Expand All @@ -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
Expand Up @@ -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 的哈希值为 <code>${hash}</code>。'
DDDDD12138 marked this conversation as resolved.
Show resolved Hide resolved
}


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