Skip to content

Commit 8174c10

Browse files
authored
Merge pull request #39881 from my-git9/hugo-shortcodes
[zh-cn]sync docs/contribute
2 parents 27c0f0a + 8956a9b commit 8174c10

File tree

4 files changed

+100
-26
lines changed

4 files changed

+100
-26
lines changed

content/zh-cn/docs/concepts/configuration/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ to others, please don't hesitate to file an issue or submit a PR.
211211
rate.
212212
-->
213213
- 定义并使用[标签](/zh-cn/docs/concepts/overview/working-with-objects/labels/)来识别应用程序
214-
或 Deployment 的 **语义属性**,例如 `{ app.kubernetes.io/name: MyApp, tier: frontend, phase: test, deployment: v3 }`
214+
或 Deployment 的**语义属性**,例如 `{ app.kubernetes.io/name: MyApp, tier: frontend, phase: test, deployment: v3 }`
215215
你可以使用这些标签为其他资源选择合适的 Pod;
216216
例如,一个选择所有 `tier: frontend` Pod 的服务,或者 `app.kubernetes.io/name: MyApp` 的所有 `phase: test` 组件。
217217
有关此方法的示例,请参阅 [guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/)

content/zh-cn/docs/contribute/localization.md

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,27 @@ standard](https://www.loc.gov/standards/iso639-2/php/code_list.php) to find your
6464
localization's two-letter language code. For example, the two-letter code for
6565
Korean is `ko`.
6666
67-
### Fork and clone the repo
68-
69-
First, [create your own
70-
fork](/docs/contribute/new-content/open-a-pr/#fork-the-repo) of the
71-
[kubernetes/website](https://github.com/kubernetes/website) repository.
67+
Some languages use a lowercase version of the country code as defined by the
68+
ISO-3166 along with their language codes. For example, the Brazilian Portuguese
69+
language code is `pt-br`.
7270
-->
7371
### 找到两个字母的语言代码 {#find-your-two-letter-language-code}
7472

7573
首先,有关本地化的两个字母的语言代码,请参考
7674
[ISO 639-1 标准](https://www.loc.gov/standards/iso639-2/php/code_list.php)
7775
例如,韩语的两个字母代码是 `ko`
7876

77+
一些语言使用 ISO-3166 定义的国家代码的小写版本及其语言代码。
78+
例如,巴西葡萄牙语代码是 `pt-br`
79+
80+
81+
<!--
82+
### Fork and clone the repo
83+
84+
First, [create your own
85+
fork](/docs/contribute/new-content/open-a-pr/#fork-the-repo) of the
86+
[kubernetes/website](https://github.com/kubernetes/website) repository.
87+
-->
7988
### 派生(fork)并且克隆仓库 {#fork-and-clone-the-repo}
8089

8190
首先,为 [kubernetes/website](https://github.com/kubernetes/website) 仓库
@@ -155,6 +164,20 @@ You'll need to know the two-letter language code for your language. Consult the
155164
to find your localization's two-letter language code. For example, the
156165
two-letter code for Korean is `ko`.
157166
167+
If the language you are starting a localization for is spoken in various places
168+
with significant differences between the variants, it might make sense to
169+
combine the lowercased ISO-3166 country code with the language two-letter code.
170+
For example, Brazilian Portuguese is localized as `pt-br`.
171+
-->
172+
你需要知道你的语言的两个字母的语言代码。
173+
请查阅 [ISO 639-1 标准](https://www.loc.gov/standards/iso639-2/php/code_list.php)
174+
以查找你的本地化的两字母语言代码。例如,韩语的两字母代码是 `ko`
175+
176+
如果你开始本地化的语言在不同地方使用,并且变体之间存在显着差异,
177+
则将小写的 ISO-3166 国家/地区代码与语言双字母代码结合起来可能是有意义的。
178+
例如,巴西葡萄牙语被本地化为 `pt-br`
179+
180+
<!--
158181
When you start a new localization, you must localize all the
159182
[minimum required content](#minimum-required-content) before
160183
the Kubernetes project can publish your changes to the live
@@ -163,10 +186,6 @@ website.
163186
SIG Docs can help you work on a separate branch so that you
164187
can incrementally work towards that goal.
165188
-->
166-
你需要知道你的语言的两个字母的语言代码。
167-
请查阅 [ISO 639-1 标准](https://www.loc.gov/standards/iso639-2/php/code_list.php)
168-
以查找你的本地化的两字母语言代码。例如,韩语的两字母代码是`ko`
169-
170189
当你开始新的本地化时,你必须先本地化所有[最少要求的内容](#minimum-required-content)
171190
Kubernetes 项目才能将你的更改发布到当前网站。
172191

@@ -633,11 +652,11 @@ To find source files for your target version:
633652
1. Navigate to the Kubernetes website repository at https://github.com/kubernetes/website.
634653
2. Select a branch for your target version from the following table:
635654

636-
Target version | Branch
637-
-----|-----
638-
Latest version | [`main`](https://github.com/kubernetes/website/tree/main)
639-
Previous version | [`release-{{< skew prevMinorVersion >}}`](https://github.com/kubernetes/website/tree/release-{{< skew prevMinorVersion >}})
640-
Next version | [`dev-{{< skew nextMinorVersion >}}`](https://github.com/kubernetes/website/tree/dev-{{< skew nextMinorVersion >}})
655+
Target version | Branch
656+
-----|-----
657+
Latest version | [`main`](https://github.com/kubernetes/website/tree/main)
658+
Previous version | [`release-{{< skew prevMinorVersion >}}`](https://github.com/kubernetes/website/tree/release-{{< skew prevMinorVersion >}})
659+
Next version | [`dev-{{< skew nextMinorVersion >}}`](https://github.com/kubernetes/website/tree/dev-{{< skew nextMinorVersion >}})
641660

642661
The `main` branch holds content for the current release `{{< latest-version >}}`.
643662
The release team creates a `{{< release-branch >}}` branch before the next
@@ -653,11 +672,11 @@ release: v{{< skew nextMinorVersion >}}.
653672
1. 导航到 Kubernetes website 仓库,网址为 https://github.com/kubernetes/website。
654673
2. 从下面的表格中选择你的目标版本分支:
655674

656-
目标版本 | 分支
657-
-----|-----
658-
最新版本 | [`main`](https://github.com/kubernetes/website/tree/main)
659-
上一个版本 | [`release-{{< skew prevMinorVersion >}}`](https://github.com/kubernetes/website/tree/release-{{< skew prevMinorVersion >}})
660-
下一个版本 | [`dev-{{< skew nextMinorVersion >}}`](https://github.com/kubernetes/website/tree/dev-{{< skew nextMinorVersion >}})
675+
目标版本 | 分支
676+
-----|-----
677+
最新版本 | [`main`](https://github.com/kubernetes/website/tree/main)
678+
上一个版本 | [`release-{{< skew prevMinorVersion >}}`](https://github.com/kubernetes/website/tree/release-{{< skew prevMinorVersion >}})
679+
下一个版本 | [`dev-{{< skew nextMinorVersion >}}`](https://github.com/kubernetes/website/tree/dev-{{< skew nextMinorVersion >}})
661680

662681
`main` 分支中保存的是当前发行版本 `{{< latest-version >}}` 的内容。
663682
发行团队会在下一个发行版本 v{{< skew nextMinorVersion >}} 出现之前创建

content/zh-cn/docs/contribute/style/hugo-shortcodes/index.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,63 @@ Renders to:
448448
{{< tab name="JSON File" include="podtemplate.json" />}}
449449
{{< /tabs >}}
450450

451+
<!--
452+
### Source code files
453+
You can use the `{{</* codenew */>}}` shortcode to embed the contents of file
454+
in a code block to allow users to download or copy its content to their clipboard.
455+
This shortcode is used when the contents of the sample file is generic and reusable,
456+
and you want the users to try it out themselves.
457+
-->
458+
你可以使用 `{{</* codenew */>}}` 短代码将文件内容嵌入代码块中,
459+
以允许用户下载或复制其内容到他们的剪贴板。
460+
当示例文件的内容是通用的、可复用的,并且希望用户自己尝试使用示例文件时,
461+
可以使用此短代码。
462+
463+
<!--
464+
This shortcode takes in two named parameters: `language` and `file`.
465+
The mandatory parameter `file` is used to specify the path to the file
466+
being displayed. The optional parameter `language` is used to specify
467+
the programming language of the file. If the `language` parameter is not provided,
468+
the shortcode will attempt to guess the language based on the file extension.
469+
470+
For example:
471+
-->
472+
这个短代码有两个命名参数:`language``file`
473+
必选参数 `file` 用于指定要显示的文件的路径,
474+
可选参数 `language` 用于指定文件的编程语言。
475+
如果未提供 `language` 参数,短代码将尝试根据文件扩展名推测编程语言。
476+
477+
```none
478+
{{</* codenew language="yaml" file="application/deployment-scale.yaml" */>}}
479+
```
480+
481+
<!--
482+
The output is:
483+
-->
484+
输出是:
485+
486+
{{< codenew language="yaml" file="application/deployment-scale.yaml" >}}
487+
488+
<!--
489+
When adding a new sample file, such as a YAML file, create the file in one
490+
of the `<LANG>/examples/` subdirectories where `<LANG>` is the language for
491+
the page. In the markdown of your page, use the `codenew` shortcode:
492+
-->
493+
添加新的示例文件(例如 YAML 文件)时,在 `<LANG>/examples/`
494+
子目录之一中创建该文件,其中 `<LANG>` 是页面的语言。
495+
在你的页面的 markdown 文本中,使用 `codenew` 短代码:
496+
497+
```none
498+
{{</* codenew file="<RELATIVE-PATH>/example-yaml>" */>}}
499+
```
500+
501+
其中 `<RELATIVE-PATH>` 是要包含的示例文件的路径,相对于 `examples` 目录。
502+
以下短代码引用位于 `/content/en/examples/configmap/configmaps.yaml` 的 YAML 文件。
503+
504+
```none
505+
{{</* codenew file="configmap/configmaps.yaml" */>}}
506+
```
507+
451508
<!--
452509
## Third party content marker
453510
-->

content/zh-cn/docs/contribute/style/style-guide.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -974,12 +974,8 @@ Do | Don't
974974
Update the title in the front matter of the page or blog post. | Use first level heading, as Hugo automatically converts the title in the front matter of the page into a first-level heading.
975975
Use ordered headings to provide a meaningful high-level outline of your content. | Use headings level 4 through 6, unless it is absolutely necessary. If your content is that detailed, it may need to be broken into separate articles.
976976
Use pound or hash signs (`#`) for non-blog post content. | Use underlines (`---` or `===`) to designate first-level headings.
977-
Use sentence case for headings in the page body. For example,
978-
**Extend kubectl with plugins** | Use title case for headings in the page body. For example, **Extend Kubectl With Plugins**
979-
Use title case for the page title in the front matter. For example,
980-
`title: Kubernetes API Server Bypass Risks` | Use sentence case for page titles
981-
in the front matter. For example, don't use
982-
`title: Kubernetes API server bypass risks`
977+
Use sentence case for headings in the page body. For example, **Extend kubectl with plugins** | Use title case for headings in the page body. For example, **Extend Kubectl With Plugins**
978+
Use title case for the page title in the front matter. For example, `title: Kubernetes API Server Bypass Risks` | Use sentence case for page titles in the front matter. For example, don't use `title: Kubernetes API server bypass risks`
983979
{{< /table >}}
984980
-->
985981
{{< table caption = "标题约定" >}}
@@ -1342,9 +1338,11 @@ These steps ... | These simple steps ...
13421338
<!--
13431339
* Learn about [writing a new topic](/docs/contribute/style/write-new-topic/).
13441340
* Learn about [using page templates](/docs/contribute/style/page-content-types/).
1341+
* Learn about [custom hugo shortcodes](/docs/contribute/style/hugo-shortcodes/).
13451342
* Learn about [creating a pull request](/docs/contribute/new-content/open-a-pr/).
13461343
-->
13471344
* 了解[编写新主题](/zh-cn/docs/contribute/style/write-new-topic/)
13481345
* 了解[页面内容类型](/zh-cn/docs/contribute/style/page-content-types/)
1346+
* 了解[定制 Hugo 短代码](/zh-cn/docs/contribute/style/hugo-shortcodes/)
13491347
* 了解[发起 PR](/zh-cn/docs/contribute/new-content/open-a-pr/)
13501348

0 commit comments

Comments
 (0)