Skip to content

Commit 9352ccc

Browse files
jsbugwangYucohny
andauthored
docs(cn): translate src/content/contribute/writers-guide.mdx (#1342)
Co-authored-by: Yucohny <yucohny@163.com>
1 parent 04b4132 commit 9352ccc

File tree

1 file changed

+99
-94
lines changed

1 file changed

+99
-94
lines changed
Lines changed: 99 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,71 @@
11
---
2-
title: Writer's Guide
2+
title: 作者指引
33
sort: 1
44
contributors:
55
- pranshuchittora
66
- EugeneHlushko
7+
translators:
8+
- jsbugwang
9+
- Yucohny
710
---
811

9-
The following sections contain all you need to know about editing and formatting the content within this site. Make sure to do some research before starting your edits or additions. Sometimes the toughest part is finding where the content should live and determining whether or not it already exists.
12+
以下部分包含编辑和格式化本网站内容的所有必需知识。请确保在开始编辑或添加之前,你已经进行过一些研究。有时候最困难的地方在于,确定内容应该在哪和确定它是否存在。
1013

11-
## Process $#process$
14+
## 步骤 $#process$
1215

13-
1. Check related issue if an article links to one.
14-
2. Hit `edit` and expand on the structure.
15-
3. PR changes.
16+
1. 如果文章包含 issue 链接,先查看 issue。
17+
2. 点击编辑并阐述结构。
18+
3. 提交 PR 修改。
1619

17-
## YAML Frontmatter $#yaml-frontmatter$
20+
## YAML 文件顶部信息 $#yaml-frontmatter$
1821

19-
Each article contains a small section at the top written in [YAML Frontmatter](https://jekyllrb.com/docs/frontmatter/):
22+
每篇文章的顶部都包含一小部分 [YAML Frontmatter](https://jekyllrb.com/docs/frontmatter/) 格式的内容:
2023

2124
```yaml
2225
---
23-
title: My Article
24-
group: My Sub-Section
26+
title: 我的文章
27+
group: 我的小节
2528
sort: 3
2629
contributors:
27-
- [github username]
30+
- [github 用户名]
2831
related:
29-
- title: Title of Related Article
30-
url: [url of related article]
32+
- title: 相关文章的标题
33+
url: [相关文章的 url]
3134
---
3235
```
3336

34-
Let's break these down:
37+
让我们来逐个分析:
3538

36-
- `title`: The name of the article.
37-
- `group`: The name of the sub-section
38-
- `sort`: The order of the article within its section (or) sub-section if it is present.
39-
- `contributors`: A list of GitHub usernames who have contributed to this article.
40-
- `related`: Any related reading or useful examples.
39+
- `title`:文章的名称。
40+
- `group`:小节的名称。
41+
- `sort`:这篇文章在此类(或子类)中的顺序(如果存在同类)。
42+
- `contributors`:文章贡献者的 GitHub 用户名列表。
43+
- `related`:任何相关阅读或有用示例。
4144

42-
Note that `related` will generate a **Further Reading** section at the bottom of the page and `contributors` will yield a **Contributors** section below it. If you edit an article and would like recognition, don't hesitate to add your GitHub username to the `contributors` list.
45+
请注意,`related` 将在页面底部生成 **Further Reading** 部分,`contributors` 将在其下生成 **Contributors** 部分。如果你编辑了一篇文章,并希望获得认可,请不要犹豫,将你的 GitHub 用户名添加到 `contributors` 列表中。
4346

44-
## Article Structure $#article-structure$
47+
## 文章结构 $#article-structure$
4548

46-
1. Brief Introduction - a paragraph or two so you get the basic idea about the what and why.
47-
2. Outline Remaining Content – how the content will be presented.
48-
3. Main Content - tell what you promised to tell.
49-
4. Conclusion - tell what you told and recap the main points.
49+
1. 简介 —— 一两个段落,以便你了解关于什么和为什么的基本想法。
50+
2. 概述剩余内容 —— 将如何呈现内容。
51+
3. 主要内容 —— 讲述你承诺要讲的内容。
52+
4. 结论 —— 讲述你讲了什么并复述要点。
5053

51-
## Typesetting $#typesetting$
54+
## 排版 $#typesetting$
5255

53-
- Webpack can be written with a capital W at the beginning of a sentence. ([source](https://github.com/webpack/media#name))
54-
- loaders are enclosed in backticks and [kebab-cased](https://en.wikipedia.org/w/index.php?title=Kebab_case): `css-loader`, `ts-loader`,
55-
- plugins are enclosed in backticks and [camel-cased](https://en.wikipedia.org/wiki/Camel_case): `BannerPlugin`, `NpmInstallWebpackPlugin`,
56-
- Use "webpack 2" to refer to a specific webpack version (~~"webpack v2"~~)
57-
- Use ES5; ES2015, ES2016, … to refer to the ECMAScript standards (~~ES6~~, ~~ES7~~)
56+
- Webpack 作为句子的第一个单词时,W 可以大写。参考 [source](https://github.com/webpack/media#name) 以了解更多。
57+
- loader 应当用反引号包裹,并且使用 [kebab-cased](https://en.wikipedia.org/w/index.php?title=Kebab_case)`css-loader``ts-loader`,…
58+
- plugin 应当用反引号包裹,并且使用 [camel-cased](https://en.wikipedia.org/wiki/Camel_case): `BannerPlugin` `NpmInstallWebpackPlugin`,…
59+
- 使用 "webpack 2" 指代特定的 webpack 版本 (~~"webpack v2"~~)
60+
- 使用 ES5; ES2015, ES2016, …… 指代 ECMAScript 标准 (~~ES6~~, ~~ES7~~)
5861

59-
## Formatting $#formatting$
62+
> 译者注:中文文档排版规范不必依照于此。
6063
61-
### Code $#code$
64+
## 格式化 $#formatting$
6265

63-
**Syntax: \`\`\`javascript … \`\`\`**
66+
### 代码 $#code$
67+
68+
**语法:\`\`\`javascript … \`\`\`**
6469

6570
```javascript
6671
function foo() {
@@ -70,156 +75,156 @@ function foo() {
7075
foo();
7176
```
7277

73-
#### Quotation $#quotation$
78+
#### 引号 $#quotation$
7479

75-
Use single quotes in code snippets and project files (`.jsx`, `.scss` etc):
80+
在代码片段和项目文件中使用单引号 (`.jsx` `.scss` 等):
7681

7782
```diff
7883
- import webpack from "webpack";
7984
+ import webpack from 'webpack';
8085
```
8186

82-
And in inline backticks:
87+
行内反引号也是一样:
8388

84-
**correct**
89+
**正确**
8590

86-
Set value to `'index.md'`...
91+
把值设置为 `'index.md'`……
8792

88-
**incorrect**
93+
**错误**
8994

90-
Set value to `"index.md"`...
95+
把值设置为 `"index.md"`……
9196

92-
### Lists $#lists$
97+
### 列表 $#lists$
9398

9499
- Boo
95100
- Foo
96101
- Zoo
97102

98-
Lists should be ordered alphabetically.
103+
列表应该按字母顺序排序。
99104

100-
### Tables $#tables$
105+
### 表格 $#tables$
101106

102-
| Parameter | Explanation | Input Type | Default Value |
103-
| ---------- | ------------------------------------------------ | ---------- | ------------- |
104-
| --debug | Switch loaders to debug mode | boolean | false |
105-
| --devtool | Define source map type for the bundled resources | string | - |
106-
| --progress | Print compilation progress in percentage | boolean | false |
107+
| 参数 | 解释说明 | 输入类型 | 默认值 |
108+
| ---------- | -------------------------------- | -------- | ------ |
109+
| --debug | 把 loader 切换为 debug 模式 | boolean | false |
110+
| --devtool | 为打包的资源定义 source map 类型 | string | - |
111+
| --progress | 打印 compilation 的百分比进度 | boolean | false |
107112

108-
Tables should also be ordered alphabetically.
113+
表格也应该按字母顺序排序。
109114

110-
### Configuration Properties $#configuration-properties$
115+
### 配置属性 $#configuration-properties$
111116

112-
The [configuration](/configuration) properties should be ordered alphabetically as well:
117+
[配置](/configuration) 属性,应该按字母顺序排序:
113118

114119
- `devServer.compress`
115120
- `devServer.hot`
116121
- `devServer.static`
117122

118-
### Quotes $#quotes$
123+
### 引用 $#quotes$
119124

120-
#### Blockquote $#blockquote$
125+
#### 引用块 $#blockquote$
121126

122-
**Syntax: \>**
127+
**语法:\>**
123128

124-
> This is a blockquote.
129+
> 这是一个引用块。
125130
126-
#### Tip $#tip$
131+
#### 提示 $#tip$
127132

128-
**Syntax: T\>**
133+
**语法:T\>**
129134

130-
T> This is a tip.
135+
T> 这是一个提示。
131136

132-
**Syntax: W\>**
137+
**语法:W\>**
133138

134-
W> This is a warning.
139+
W> 这是一个警告。
135140

136-
**Syntax: ?\>**
141+
**语法:?\>**
137142

138-
?> This is a todo.
143+
?> 这是一个 todo 待办项。
139144

140-
### Assumptions and simplicity $#assumptions-and-simplicity$
145+
### 假设与详略 $#assumptions-and-simplicity$
141146

142-
Do not make assumptions when writing the documentation.
147+
写文档时,不要做假设:
143148

144149
```diff
145-
- You might already know how to optimize bundle for production...
146-
+ As we've learned in [production guide](/guides/production/)...
150+
- 你可能已经知道如何为生产环境优化 bundle ……
151+
+ 我们在 [production guide](/guides/production/) 学习过……
147152
```
148153

149-
Please do not assume things are simple. Avoid words like 'just', 'simply'.
154+
请不要假设事情简单。避免使用词汇“只是”,“简单地”。
150155

151156
```diff
152-
- Simply run command...
153-
+ Run the `command-name` command...
157+
- 简单地运行命令……
158+
+ 运行 `command-name` 命令……
154159
```
155160

156-
### Configuration defaults and types $#configuration-defaults-and-types$
161+
### 配置的默认值和类型 $#configuration-defaults-and-types$
157162

158-
Always provide types and defaults to all of the documentation options in order to keep the documentation accessible and well-written. We are adding types and defaults after entitling the documented option:
163+
总是为所有文档选项提供类型和默认值,以保持文档的可读性和良好书写。我们在选项后面加上类型和默认值:
159164

160165
**configuration.example.option**
161166

162167
`string = 'none'`
163168

164-
Where `= 'none'` means that the default value is `'none'` for the given option.
169+
这里 `= 'none'` 表示指定选项的默认值是 `'none'`
165170

166171
`string = 'none': 'none' | 'development' | 'production'`
167172

168-
Where `: 'none' | 'development' | 'production'` enumerates the possible type values, in this case, three strings are acceptable: `'none'`, `'development'`, and `'production'`.
173+
这里 `: 'none' | 'development' | 'production'` 枚举所有可能的类型值,本例接受 3 个字符串:`'none'`, `'development'` `'production'`
169174

170-
Use space between types to list all available types for the given option:
175+
在类型之间使用空格,为指定选项列举所有可用的类型:
171176

172177
`string = 'none': 'none' | 'development' | 'production'` `boolean`
173178

174-
To mark an array, use square brackets:
179+
使用方括号表示数组:
175180

176181
`string` `[string]`
177182

178-
If multiple types are allowed in `array`, use comma:
183+
如果 `数组` 允许多种类型,使用英文逗号:
179184

180185
`string` `[string, RegExp, function(arg) => string]`
181186

182-
To mark a function, also list arguments when they are available:
187+
标记为函数时,如果有参数,应同时把参数列出来:
183188

184189
`function (compilation, module, path) => boolean`
185190

186-
Where `(compilation, module, path)` lists the arguments that the provided function will receive and `=> boolean` means that the return value of the function must be a `boolean`.
191+
这里 `(compilation, module, path)` 列举指定函数接受的参数,`=> boolean` 表示函数返回值的类型必须是 `boolean`
187192

188-
To mark a Plugin as an available option value type, use the camel case title of the `Plugin`:
193+
标记 Plugin 为可用的选项值类型时,使用 `Plugin`camel case 标题:
189194

190195
`TerserPlugin` `[TerserPlugin]`
191196

192-
Which means that the option expects one or few `TerserPlugin` instances.
197+
这表示选项接受一个或多个 `TerserPlugin` 实例。
193198

194-
To mark a number, use `number`:
199+
使用 `number` 标记为 number
195200

196201
`number = 15: 5, 15, 30`
197202

198-
To mark an object, use `object`:
203+
使用 `object` 标记为对象:
199204

200205
`object = { prop1 string = 'none': 'none' | 'development' | 'production', prop2 boolean = false, prop3 function (module) => string }`
201206

202-
When object's key can have multiple types, use `|` to list them. Here is an example, where `prop1` can be both a string and an array of strings:
207+
当对象的 key 可以有多个类型时,用 `|` 列来出。如下例子,`prop1` 可以是字符串或字符串数组:
203208

204209
`object = { prop1 string = 'none': 'none' | 'development' | 'production' | [string]}`
205210

206-
This allows us to display the defaults, enumeration and other information.
211+
这样我们可以展示默认值,枚举和其他信息。
207212

208-
If the object's key is dynamic, user-defined, use `<key>` to describe it:
213+
如果对象的 key 是动态的,用户自定义的,用 `<key>` 来描述:
209214

210215
`object = { <key> string }`
211216

212-
### Options shortlists and their typing $#options-shortlists-and-their-typing$
217+
### 选项 shortlist 及其类型 $#options-shortlists-and-their-typing$
213218

214-
Sometimes, we want to describe certain properties of objects and functions in lists. When applicable add typing directly to the list where properties are enlisted:
219+
有时,我们希望描述对象的某些属性,以及列表中的函数。在属性列表直接添加即可:
215220

216-
- `madeUp` (`boolean = true`): short description
217-
- `shortText` (`string = 'i am text'`): another short description
221+
- `madeUp` (`boolean = true`): 简短描述
222+
- `shortText` (`string = 'i am text'`): 另一个简短描述
218223

219-
W> `:` is not a necessity here, note the property, type and default.
224+
W> `:` 不是必须的。注意属性名,类型和默认值。
220225

221-
An example can be found on the [`options` section of the EvalSourceMapDevToolPlugin's page](/plugins/eval-source-map-dev-tool-plugin/#options).
226+
[EvalSourceMapDevToolPlugin 页面的 `选项` 部分](/plugins/eval-source-map-dev-tool-plugin/#options) 有一个例子。
222227

223-
### Adding links $#adding-links$
228+
### 添加链接 $#adding-links$
224229

225-
Please use relative URLs (such as `/concepts/mode/`) to link our own content instead of absolute URLs (such as `https://webpack.js.org/concepts/mode/`).
230+
请使用相对 URL (如 `/concepts/mode/`) 来链接到自有内容,不要用绝对 URL (如 `https://webpack.js.org/concepts/mode/`)

0 commit comments

Comments
 (0)