Skip to content

Commit 906975e

Browse files
ydfzgyjAkryum
authored andcommitted
docs: Add Chinese Doc (#329)
* docs: structure of Chinese doc * docs: translate root page to Chinese * docs: translate pages in `/guide` and `/guid/apollo` to Chinese * docs: translate pages in `/api` and `/migration` to Chinese - fix some words in completed pages * docs: translate pages in `/guide/components` to Chinese * docs: fix some words * docs: keep Chinese version up to date * docs: Chinese version up to date * docs: fix some words * docs: fix some words
1 parent c2f9b41 commit 906975e

27 files changed

+2873
-85
lines changed

docs/.vuepress/config.js

Lines changed: 196 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,215 @@
11
module.exports = {
2-
title: 'Vue Apollo',
3-
description: '🚀 Integrate GraphQL in your Vue.js apps!',
42
base: '/vue-apollo/',
53
serviceWorker: true,
64
head: [
75
['link', { rel: 'icon', href: '/favicon.png' }],
86
],
7+
locales: {
8+
'/': {
9+
lang: 'en-US',
10+
title: 'Vue Apollo',
11+
description: '🚀 Integrate GraphQL in your Vue.js apps!',
12+
},
13+
'/zh-cn/': {
14+
lang: 'zh-CN',
15+
title: 'Vue Apollo',
16+
description: '🚀 在你的 Vue.js 应用中集成 GraphQL!',
17+
}
18+
},
919
themeConfig: {
1020
repo: 'Akryum/vue-apollo',
1121
docsDir: 'docs',
1222
editLinks: true,
13-
lastUpdated: 'Last Updated',
14-
nav: [
15-
{
16-
text: 'Guide',
17-
link: '/guide/',
18-
},
19-
{
20-
text: 'API Reference',
21-
link: '/api/',
22-
},
23-
{
24-
text: 'Migration',
25-
link: '/migration/',
26-
},
27-
{
28-
text: 'CLI plugin',
29-
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
30-
},
31-
{
32-
text: 'Patreon',
33-
link: 'https://www.patreon.com/akryum',
34-
},
35-
],
36-
sidebarDepth: 3,
37-
sidebar: {
38-
'/guide/': [
39-
'',
40-
'installation',
41-
{
42-
title: 'Basic Usage',
43-
collapsable: false,
44-
children: [
45-
'apollo/',
46-
'apollo/queries',
47-
'apollo/mutations',
48-
'apollo/subscriptions',
49-
'apollo/pagination',
23+
locales: {
24+
'/': {
25+
selectText: 'Languages',
26+
label: 'English',
27+
lastUpdated: 'Last Updated',
28+
nav: [
29+
{
30+
text: 'Guide',
31+
link: '/guide/',
32+
},
33+
{
34+
text: 'API Reference',
35+
link: '/api/',
36+
},
37+
{
38+
text: 'Migration',
39+
link: '/migration/',
40+
},
41+
{
42+
text: 'CLI plugin',
43+
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
44+
},
45+
{
46+
text: 'Patreon',
47+
link: 'https://www.patreon.com/akryum',
48+
},
49+
],
50+
sidebarDepth: 3,
51+
sidebar: {
52+
'/guide/': [
53+
'',
54+
'installation',
55+
{
56+
title: 'Basic Usage',
57+
collapsable: false,
58+
children: [
59+
'apollo/',
60+
'apollo/queries',
61+
'apollo/mutations',
62+
'apollo/subscriptions',
63+
'apollo/pagination',
64+
],
65+
},
66+
{
67+
title: 'Components',
68+
collapsable: false,
69+
children: [
70+
'components/',
71+
'components/query',
72+
'components/mutation',
73+
'components/subscribe-to-more',
74+
],
75+
},
76+
{
77+
title: 'Advanced topics',
78+
collapsable: false,
79+
children: [
80+
'multiple-clients',
81+
'ssr',
82+
'local-state',
83+
'testing',
84+
],
85+
},
5086
],
51-
},
52-
{
53-
title: 'Components',
54-
collapsable: false,
55-
children: [
56-
'components/',
57-
'components/query',
58-
'components/mutation',
59-
'components/subscribe-to-more',
87+
'/api/': [
88+
{
89+
title: 'Vue Apollo',
90+
collapsable: false,
91+
children: [
92+
'apollo-provider',
93+
'dollar-apollo',
94+
'ssr',
95+
],
96+
},
97+
{
98+
title: 'Smart Apollo',
99+
collapsable: false,
100+
children: [
101+
'smart-query',
102+
'smart-subscription',
103+
],
104+
},
105+
{
106+
title: 'Apollo Components',
107+
collapsable: false,
108+
children: [
109+
'apollo-query',
110+
'apollo-subscribe-to-more',
111+
'apollo-mutation',
112+
],
113+
},
60114
],
115+
'/migration/': [''],
61116
},
62-
{
63-
title: 'Advanced topics',
64-
collapsable: false,
65-
children: [
66-
'multiple-clients',
67-
'ssr',
68-
'local-state',
69-
'testing',
70-
],
71-
},
72-
],
73-
'/api/': [
74-
{
75-
title: 'Vue Apollo',
76-
collapsable: false,
77-
children: [
78-
'apollo-provider',
79-
'dollar-apollo',
80-
'ssr',
81-
],
82-
},
83-
{
84-
title: 'Smart Apollo',
85-
collapsable: false,
86-
children: [
87-
'smart-query',
88-
'smart-subscription',
117+
},
118+
'/zh-cn/': {
119+
selectText: '选择语言',
120+
label: '简体中文',
121+
editLinks: true,
122+
lastUpdated: '上次更新时间',
123+
nav: [
124+
{
125+
text: '指南',
126+
link: '/zh-cn/guide/',
127+
},
128+
{
129+
text: 'API 参考',
130+
link: '/zh-cn/api/',
131+
},
132+
{
133+
text: '迁移',
134+
link: '/zh-cn/migration/',
135+
},
136+
{
137+
text: 'CLI 插件',
138+
link: 'https://github.com/Akryum/vue-cli-plugin-apollo',
139+
},
140+
{
141+
text: '赞助作者',
142+
link: 'https://www.patreon.com/akryum',
143+
},
144+
],
145+
sidebarDepth: 3,
146+
sidebar: {
147+
'/zh-cn/guide/': [
148+
'',
149+
'installation',
150+
{
151+
title: '基本使用',
152+
collapsable: false,
153+
children: [
154+
'apollo/',
155+
'apollo/queries',
156+
'apollo/mutations',
157+
'apollo/subscriptions',
158+
'apollo/pagination',
159+
],
160+
},
161+
{
162+
title: '组件',
163+
collapsable: false,
164+
children: [
165+
'components/',
166+
'components/query',
167+
'components/mutation',
168+
'components/subscribe-to-more',
169+
],
170+
},
171+
{
172+
title: '进阶',
173+
collapsable: false,
174+
children: [
175+
'multiple-clients',
176+
'ssr',
177+
'local-state',
178+
'testing',
179+
],
180+
},
89181
],
90-
},
91-
{
92-
title: 'Apollo Components',
93-
collapsable: false,
94-
children: [
95-
'apollo-query',
96-
'apollo-subscribe-to-more',
97-
'apollo-mutation',
182+
'/zh-cn/api/': [
183+
{
184+
title: 'Vue Apollo',
185+
collapsable: false,
186+
children: [
187+
'apollo-provider',
188+
'dollar-apollo',
189+
'ssr',
190+
],
191+
},
192+
{
193+
title: 'Smart Apollo',
194+
collapsable: false,
195+
children: [
196+
'smart-query',
197+
'smart-subscription',
198+
],
199+
},
200+
{
201+
title: 'Apollo 组件',
202+
collapsable: false,
203+
children: [
204+
'apollo-query',
205+
'apollo-subscribe-to-more',
206+
'apollo-mutation',
207+
],
208+
},
98209
],
210+
'/zh-cn/migration/': [''],
99211
},
100-
],
101-
'/migration/': [''],
212+
},
102213
},
103214
},
104215
}

docs/zh-cn/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
home: true
3+
heroImage: /logo.png
4+
actionText: 由此起步 →
5+
actionLink: /zh-cn/guide/
6+
features:
7+
- title: 自动更新
8+
details: 无需考虑更新 UI 或重新获取查询的问题!
9+
- title: 模板内组件
10+
details: 通过 Apollo 组件声明式地使用 Apollo
11+
- title: 支持 SSR
12+
details: 在渲染 HTML 页面之前在服务端运行你的查询
13+
footer: LICENCE ISC - Created by Guillaume CHAU (@Akryum)
14+
---
15+
16+
<p style="text-align: center;">
17+
<a href="https://www.patreon.com/akryum" target="_blank">
18+
<img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patreon">
19+
</a>
20+
</p>

docs/zh-cn/api/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# API 参考
2+
3+
欢迎查看 API 参考!
4+
5+
::: warning Work-in-Progress
6+
如果你发现缺少了某些东西,请创建一个代码合并请求!
7+
:::

docs/zh-cn/api/apollo-mutation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ApolloMutation 组件
2+
3+
## Props
4+
5+
- `mutation`:GraphQL 查询(由 `graphql-tag` 转换)
6+
- `variables`:GraphQL 变量对象
7+
- `optimisticResponse`:详见 [乐观 UI](https://www.apollographql.com/docs/react/features/optimistic-ui.html)
8+
- `update`:详见 [变更后更新缓存](https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-mutation-options-update)
9+
- `refetchQueries`:详见 [变更后重新获取查询](https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-mutation-options-refetchQueries)
10+
- `clientId`:用于解析使用的 Apollo 客户端(在 ApolloProvider 中定义)
11+
- `tag`:字符串,HTML 标签名(默认值:`div`);如果是 `undefined`,该组件将成为无渲染组件(内容不会被包装在标签中)
12+
13+
## 作用域插槽 props
14+
15+
- `mutate(options = undefined)`:调用变更的函数。你可以重载变更的选项(例如:`mutate({ variables: { foo: 'bar } })`
16+
- `loading`:布尔值,表明请求正在进行中
17+
- `error`:最后一次变更调用的最终错误
18+
- `gqlError`:第一个 GraphQL 错误(如果有)
19+
20+
## 事件
21+
22+
- `done(resultObject)`
23+
- `error(errorObject)`

0 commit comments

Comments
 (0)