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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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'

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>。'
}


Expand Down
43 changes: 43 additions & 0 deletions docs/zh/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Vue Test Utils

Component testing utils for Vue 3.

## Languages

[🇫🇷 French version of this README.md](https://github.com/vuejs/test-utils/tree/main/docs/fr/README.md)

## Installation and Usage

- yarn: `yarn add @vue/test-utils --dev`
- npm: `npm install @vue/test-utils --save-dev`

Get started with the [documentation](https://test-utils.vuejs.org/).

## Coming from Vue 2 + Test Utils v1?

[Check the migration guide](https://test-utils.vuejs.org/migration/). It's still a work in progress. If you find a problem or something that doesn't work that previously did in Vue Test Utils v1, please open an issue.

## Documentation

See the [docs](https://test-utils.vuejs.org/).

## Development

Get started by running `pnpm install`. You can run the tests with `pnpm test`. That's it!

## Contributing Docs

All the documentation files can be found in `packages/docs`. It contains the English markdown files while translation(s) are stored in their corresponding `<lang>` sub-folder(s):

- [`fr`](https://github.com/vuejs/test-utils/tree/main/packages/docs/fr): French translation.

Besides that, the `.vitepress` sub-folder contains the config and theme, including the i18n information.

- `pnpm docs:dev`: Start the docs dev server.
- `pnpm docs:build`: Build the docs.

To add or maintain the translations, we follow the [Vue Ecosystem Translation Guidelines](https://github.com/vuejs-translations/guidelines/blob/main/README_ECOSYSTEM.md).

- `pnpm docs:translation:status [<lang>]`: Show the translation status for your language. If you don't specify a language, it will show the status for all languages.
- `pnpm docs:translation:compare <lang>`: Compare the docs with the latest checkpoint for your language.
- `pnpm docs:translation:update <lang> [<commit>]`: Update the checkpoint for your language. The checkpoint will be set by the latest commit hash. However, you can also specify a commit hash manually.
Loading