|
1 | 1 | ---
|
2 | 2 | title: 贡献新内容
|
| 3 | +content_type: 概念 |
| 4 | +main_menu: true |
3 | 5 | weight: 20
|
4 | 6 | ---
|
| 7 | +<!-- |
| 8 | +title: Contributing new content |
| 9 | +content_type: concept |
| 10 | +main_menu: true |
| 11 | +weight: 20 |
| 12 | +--> |
| 13 | + |
| 14 | +<!-- overview --> |
| 15 | + |
| 16 | +<!-- |
| 17 | +This section contains information you should know before contributing new |
| 18 | +content. |
| 19 | +--> |
| 20 | + |
| 21 | +本节包含你在贡献新内容之前需要知晓的信息。 |
| 22 | + |
| 23 | +<!-- See https://github.com/kubernetes/website/issues/28808 for live-editor URL to this figure --> |
| 24 | +<!-- You can also cut/paste the mermaid code into the live editor at https://mermaid-js.github.io/mermaid-live-editor to play around with it --> |
| 25 | + |
| 26 | +{{< mermaid >}} |
| 27 | +flowchart LR |
| 28 | + subgraph second[开始之前] |
| 29 | + direction TB |
| 30 | + S[ ] -.- |
| 31 | + A[签署 CNCF CLA] --> B[选择 Git 分支] |
| 32 | + B --> C[每个 PR 一种语言] |
| 33 | + C --> F[检查贡献者工具] |
| 34 | + end |
| 35 | + subgraph first[基本知识] |
| 36 | + direction TB |
| 37 | + T[ ] -.- |
| 38 | + D[用 markdown 编写文档<br>并用 Hugo 构建网站] --- E[GitHub 源代码] |
| 39 | + E --- G['/content/../docs' 文件夹包含<br>多语言文档] |
| 40 | + G --- H[评审 Hugo 页面内容<br>类型和短代码] |
| 41 | + end |
| 42 | + |
| 43 | + |
| 44 | + first ----> second |
| 45 | + |
| 46 | + |
| 47 | +classDef grey fill:#dddddd,stroke:#ffffff,stroke-width:px,color:#000000, font-size:15px; |
| 48 | +classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:bold |
| 49 | +classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 |
| 50 | +class A,B,C,D,E,F,G,H grey |
| 51 | +class S,T spacewhite |
| 52 | +class first,second white |
| 53 | +{{</ mermaid >}} |
| 54 | + |
| 55 | +<!-- |
| 56 | +***Figure - Contributing new content preparation*** |
| 57 | +
|
| 58 | +The figure above depicts the information you should know |
| 59 | +prior to submitting new content. The information details follow. |
| 60 | +--> |
| 61 | + |
| 62 | +***插图 - 贡献新内容准备工作*** |
| 63 | + |
| 64 | +上图描述了你在提交新内容之前需要知晓的信息。 |
| 65 | +详细信息见下文。 |
| 66 | + |
| 67 | +<!-- body --> |
| 68 | +<!-- |
| 69 | +## Contributing basics |
| 70 | +
|
| 71 | +- Write Kubernetes documentation in Markdown and build the Kubernetes site |
| 72 | + using [Hugo](https://gohugo.io/). |
| 73 | +- Kubernetes documentation uses [CommonMark](https://commonmark.org/) as its flavor of Markdown. |
| 74 | +- The source is in [GitHub](https://github.com/kubernetes/website). You can find |
| 75 | + Kubernetes documentation at `/content/en/docs/`. Some of the reference |
| 76 | + documentation is automatically generated from scripts in |
| 77 | + the `update-imported-docs/` directory. |
| 78 | +- [Page content types](/docs/contribute/style/page-content-types/) describe the |
| 79 | + presentation of documentation content in Hugo. |
| 80 | + --> |
| 81 | + |
| 82 | +## 基本知识 |
| 83 | + |
| 84 | +- 使用 Markdown 编写 Kubernetes 文档并使用 [Hugo](https://gohugo.io/) 构建网站。 |
| 85 | +- Kubernetes 文档使用 [CommonMark](https://commonmark.org/) 作为 Markdown 的风格。 |
| 86 | +- 源代码位于 [GitHub](https://github.com/kubernetes/website) 仓库中。 |
| 87 | + 你可以在 `/content/zh/docs/` 目录下找到 Kubernetes 文档。 |
| 88 | + 某些参考文档是使用位于 `update-imported-docs/` 目录下的脚本自动生成的。 |
| 89 | +- [页面内容类型](/zh/docs/contribute/style/page-content-types/)使用 Hugo 描述文档内容的呈现。 |
| 90 | + |
| 91 | +<!-- |
| 92 | +- You can use [Docsy shortcodes](https://www.docsy.dev/docs/adding-content/shortcodes/) or [custom Hugo shortcodes](/docs/contribute/style/hugo-shortcodes/) to contribute to Kubernetes documentation. |
| 93 | +- In addition to the standard Hugo shortcodes, we use a number of |
| 94 | + [custom Hugo shortcodes](/docs/contribute/style/hugo-shortcodes/) in our |
| 95 | + documentation to control the presentation of content. |
| 96 | +- Documentation source is available in multiple languages in `/content/`. Each |
| 97 | + language has its own folder with a two-letter code determined by the |
| 98 | + [ISO 639-1 standard](https://www.loc.gov/standards/iso639-2/php/code_list.php) |
| 99 | + . For example, English documentation source is stored in `/content/en/docs/`. |
| 100 | +- For more information about contributing to documentation in multiple languages |
| 101 | + or starting a new translation, |
| 102 | + see [localization](/docs/contribute/localization). |
| 103 | +--> |
| 104 | + |
| 105 | +- 你可以使用 [Docsy 短代码](https://www.docsy.dev/docs/adding-content/shortcodes/) |
| 106 | + 或[定制的 Hugo 短代码](/zh/docs/contribute/style/hugo-shortcodes/)贡献 Kubernetes 文档。 |
| 107 | +- 除了标准的 Hugo 短代码外, |
| 108 | + 我们还在文档中使用一些[定制的 Hugo 短代码](/zh/docs/contribute/style/hugo-shortcodes/)来控制内容的呈现。 |
| 109 | +- 文档的源代码有多种语言形式,位于 `/content/` 目录下。 |
| 110 | + 每种语言都有一个自己的目录,用两个字母表示,这两个字母是基于 |
| 111 | + [ISO 639-1 标准](https://www.loc.gov/standards/iso639-2/php/code_list.php)来确定的。 |
| 112 | + 例如,英语文档的源代码位于 `/content/en/docs/` 目录下。 |
| 113 | +- 关于为多语言文档做贡献以及如何开始新翻译的详细信息, |
| 114 | + 可参考[本地化文档](/zh/docs/contribute/localization)。 |
| 115 | + |
| 116 | +<!-- |
| 117 | +## Before you begin {#before-you-begin} |
| 118 | +### Sign the CNCF CLA {#sign-the-cla} |
| 119 | +All Kubernetes contributors **must** read |
| 120 | +the [Contributor guide](https://github.com/kubernetes/community/blob/master/contributors/guide/README.md) |
| 121 | +and [sign the Contributor License Agreement (CLA)](https://github.com/kubernetes/community/blob/master/CLA.md). |
| 122 | +Pull requests from contributors who haven't signed the CLA fail the automated |
| 123 | +tests. The name and email you provide must match those found in |
| 124 | +your `git config`, and your git name and email must match those used for the |
| 125 | +CNCF CLA. |
| 126 | +--> |
| 127 | + |
| 128 | +## 开始之前 {#before-you-begin} |
| 129 | + |
| 130 | +### 签署 CNCF CLA {#sign-the-cla} |
| 131 | + |
| 132 | +所有 Kubernetes 贡献者**必须**阅读[贡献者指南](https://github.com/kubernetes/community/blob/master/contributors/guide/README.md) |
| 133 | +并[签署贡献者授权同意书 (Contributor License Agreement, CLA)](https://github.com/kubernetes/community/blob/master/CLA.md)。 |
| 134 | + |
| 135 | +若贡献者尚未签署 CLA,其发起的 PR 将无法通过自动化测试。 |
| 136 | +你所提供的姓名和邮件地址必须与 `git config` 中配置的完全相同, |
| 137 | +而且你的 git 用户名和邮件地址必须与用来签署 CNCF CLA 的信息一致。 |
| 138 | + |
| 139 | +<!-- |
| 140 | +### Choose which Git branch to use |
| 141 | +
|
| 142 | +When opening a pull request, you need to know in advance which branch to base |
| 143 | +your work on. |
| 144 | +
|
| 145 | +Scenario | Branch |
| 146 | +:---------|:------------ |
| 147 | +Existing or new English language content for the current release | `main` |
| 148 | +Content for a feature change release | The branch which corresponds to the major and minor version the feature change is in, using the pattern `dev-<version>`. For example, if a feature changes in the `v{{< skew nextMinorVersion >}}` release, then add documentation changes to the ``dev-{{< skew nextMinorVersion >}}`` branch. |
| 149 | +Content in other languages (localizations) | Use the localization's convention. See the [Localization branching strategy](/docs/contribute/localization/#branching-strategy) for more information. |
| 150 | +
|
| 151 | +If you're still not sure which branch to choose, ask in `#sig-docs` on Slack. |
| 152 | +--> |
| 153 | + |
| 154 | +### 选择要使用的 Git 分支 |
| 155 | + |
| 156 | +在发起 PR 时,你需要预先知道基于哪个分支来开展工作。 |
| 157 | + |
| 158 | +场景 | 分支 |
| 159 | +:---------|:------------ |
| 160 | +针对当前发行版本的,对现有英文内容的修改或新的英文内容 | `main` |
| 161 | + 针对功能特性变更的内容 | 分支对应于功能特性变更的主要和次要版本,分支名称采用 `dev-<version>` 的模式。例如,如果某功能特性在 `v{{< skew nextMinorVersion >}}` 版本发生变化,则对应的文档变化要添加到 `dev-{{< skew nextMinorVersion >}}` 分支。 |
| 162 | + 其他语言的内容(本地化) | 基于本地化团队的约定。参见[本地化分支策略](/zh/docs/contribute/localization/#branching-strategy)了解更多信息。 |
| 163 | + |
| 164 | +如果你仍不能确定要选择哪个分支,请在 Slack 的 `#sig-docs` 频道上提出问题。 |
| 165 | + |
| 166 | +<!-- |
| 167 | +{{< note >}} If you already submitted your pull request and you know that the |
| 168 | +base branch was wrong, you (and only you, the submitter) can change it. {{< |
| 169 | +/note >}} |
| 170 | +--> |
| 171 | + |
| 172 | +{{< note >}} |
| 173 | +如果你已经提交了 PR,并且发现所针对的分支选错了,你(且只有作为提交人的你)可以更改分支。 |
| 174 | +{{< /note >}} |
| 175 | + |
| 176 | +<!-- |
| 177 | +### Languages per PR |
| 178 | +
|
| 179 | +Limit pull requests to one language per PR. If you need to make an identical |
| 180 | +change to the same code sample in multiple languages, open a separate PR for |
| 181 | +each language. |
| 182 | +--> |
| 183 | + |
| 184 | +### 每个 PR 牵涉的语言 |
| 185 | + |
| 186 | +请确保每个 PR 仅涉及一种语言。 |
| 187 | +如果你需要对多种语言下的同一代码示例进行相同的修改,也请为每种语言发起一个独立的 PR。 |
| 188 | + |
| 189 | +<!-- |
| 190 | +## Tools for contributors |
| 191 | +
|
| 192 | +The [doc contributors tools](https://github.com/kubernetes/website/tree/main/content/en/docs/doc-contributor-tools) |
| 193 | +directory in the `kubernetes/website` repository contains tools to help your |
| 194 | +contribution journey go more smoothly. |
| 195 | +--> |
| 196 | + |
| 197 | +## 为贡献者提供的工具 |
| 198 | + |
| 199 | +`kubernetes/website` 仓库的[文档贡献者工具](https://github.com/kubernetes/website/tree/main/content/zh/docs/doc-contributor-tools)目录中包含了一些工具, |
| 200 | +有助于使你的贡献过程更为顺畅。 |
0 commit comments