Skip to content

Commit 9d5b888

Browse files
committed
docs: Synchronize Chinese localization with upstream
1 parent 2022ef9 commit 9d5b888

File tree

1 file changed

+142
-74
lines changed
  • content/zh/docs/contribute/style/hugo-shortcodes

1 file changed

+142
-74
lines changed

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

Lines changed: 142 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ content_type: concept
99

1010
<!-- overview -->
1111

12-
<!-- This page explains the custom Hugo shortcodes that can be used in Kubernetes markdown documentation. -->
13-
本页面将介绍定制 Hugo 短代码,可以用于 Kubernetes markdown 文档书写。
12+
<!-- This page explains the custom Hugo shortcodes that can be used in Kubernetes Markdown documentation. -->
13+
本页面将介绍 Hugo 自定义短代码,可以用于 Kubernetes Markdown 文档书写。
1414

1515
<!-- Read more about shortcodes in the [Hugo documentation](https://gohugo.io/content-management/shortcodes). -->
1616
关于短代码的更多信息可参见 [Hugo 文档](https://gohugo.io/content-management/shortcodes)
@@ -20,31 +20,31 @@ content_type: concept
2020
<!--
2121
## Feature state
2222
23-
In a markdown page (.md file) on this site, you can add a shortcode to display
23+
In a Markdown page (.md file) on this site, you can add a shortcode to display
2424
version and state of the documented feature.
2525
-->
2626
## 功能状态
2727

28-
在本站的 markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。
28+
在本站的 Markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。
2929

3030
<!--
3131
### Feature state demo
3232
33-
Below is a demo of the feature state snippet, which displays the feature as stable
34-
in Kubernetes version 1.10.
33+
Below is a demo of the feature state snippet, which displays the feature as stable
34+
in the latest Kubernetes version.
3535
-->
3636
### 功能状态示例
3737

38-
下面是一个功能状态代码段的演示,表明这个功能已经在 Kubernetes v1.10 时就已经稳定了
38+
下面是一个功能状态代码段的演示,表明这个功能已经在最新版 Kubernetes 中稳定了
3939

4040
```
41-
{{</* feature-state for_k8s_version="v1.10" state="stable" */>}}
41+
{{</* feature-state state="stable" */>}}
4242
```
4343

44-
<!-- Will render to: -->
44+
<!-- Renders to: -->
4545
会转换为:
4646

47-
{{< feature-state for_k8s_version="v1.10" state="stable" >}}
47+
{{< feature-state state="stable" >}}
4848

4949
<!-- The valid values for `state` are: -->
5050
`state` 的可选值如下:
@@ -57,91 +57,42 @@ in Kubernetes version 1.10.
5757
<!--
5858
### Feature state code
5959
60-
The displayed Kubernetes version defaults to that of the page or the site.
61-
This can be changed by passing the <code>for_k8s_version</code> shortcode
62-
parameter.
60+
The displayed Kubernetes version defaults to that of the page or the site. You can change the
61+
feature state version by passing the `for_k8s_version` shortcode parameter. For example:
6362
-->
6463
### 功能状态代码
6564

6665
所显示的 Kubernetes 默认为该页或站点版本。
67-
可以通过修改 <code>for_k8s_version</code> 短代码参数来调整要显示的版本。
68-
69-
```
70-
{{</* feature-state for_k8s_version="v1.11" state="stable" */>}}
71-
```
72-
73-
<!-- Renders to: -->
74-
会转换为:
75-
76-
{{< feature-state for_k8s_version="v1.11" state="stable" >}}
77-
78-
<!-- #### Alpha feature -->
79-
#### Alpha 功能
80-
81-
```
82-
{{</* feature-state feature-state state="alpha" */>}}
83-
```
84-
85-
<!-- Renders to: -->
86-
会转换为:
87-
88-
{{< feature-state state="alpha" >}}
89-
90-
<!-- #### Beta feature -->
91-
#### Beta 功能
66+
修改 <code>for_k8s_version</code> 短代码参数可以调整要显示的版本。例如
9267

9368
```
94-
{{</* feature-state feature-state state="beta" */>}}
69+
{{</* feature-state for_k8s_version="v1.10" state="beta" */>}}
9570
```
9671

9772
<!-- Renders to: -->
9873
会转换为:
9974

100-
{{< feature-state state="beta" >}}
101-
102-
<!-- #### Stable feature -->
103-
#### 稳定功能
104-
105-
```
106-
{{</* feature-state feature-state state="stable" */>}}
107-
```
108-
109-
<!-- Renders to: -->
110-
会转换为:
111-
112-
{{< feature-state state="stable" >}}
113-
114-
<!-- #### Deprecated feature -->
115-
#### 废弃功能
116-
117-
```
118-
{{</* feature-state feature-state state="deprecated" */>}}
119-
```
120-
121-
<!-- Renders to: -->
122-
会转换为:
123-
124-
{{< feature-state state="deprecated" >}}
75+
{{< feature-state for_k8s_version="v1.10" state="beta" >}}
12576

12677
<!--
12778
## Glossary
128-
There are two glossary tooltips.
79+
There are two glossary shortcodes: `glossary_tooltip` and `glossary_definition`.
12980
13081
You can reference glossary terms with an inclusion that will automatically
13182
update and replace content with the relevant links from [our
132-
glossary](/docs/reference/glossary/). When the term is moused-over by someone
133-
using the online documentation, the glossary entry will display a tooltip.
83+
glossary](/docs/reference/glossary/). When the glossary term is moused-over,
84+
the glossary entry displays a tooltip. The glossary term also displays as a link.
13485
13586
As well as inclusions with tooltips, you can reuse the definitions from the glossary in
13687
page content.
13788
-->
13889
## 词汇
13990

140-
有两种词汇表提示。
91+
有两种词汇表提示:<code>glossary_tooltip</code> 和 <code>glossary_definition</code>
14192

14293
你可以通过加入术语词汇的短代码,来自动更新和替换相应链接中的内容
14394
[我们的词汇库](/zh/docs/reference/glossary/)
144-
这样,在浏览在线文档,鼠标移到术语上时,术语解释就会显示在提示框中
95+
在浏览在线文档时,术语会显示为超链接的样式,当鼠标移到术语上时,其解释就会显示在提示框中
14596

14697
除了包含工具提示外,你还可以重用页面内容中词汇表中的定义。
14798
<!--
@@ -153,12 +104,12 @@ The raw data for glossary terms is stored at [https://github.com/kubernetes/webs
153104
<!--
154105
### Glossary demo
155106
156-
For example, the following include within the markdown will render to
107+
For example, the following include within the Markdown will render to
157108
{{< glossary_tooltip text="cluster" term_id="cluster" >}} with a tooltip:
158109
-->
159110
### 词汇演示
160111

161-
例如,下面的代码在 markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`
112+
例如,下面的代码在 Markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`
162113
然后在提示框中显示。
163114

164115
```
@@ -191,7 +142,6 @@ You can also include a full definition:
191142

192143
<!--
193144
which renders as:
194-
{{< glossary_definition term_id="cluster" length="all" >}}
195145
-->
196146
呈现为:
197147
{{< glossary_definition term_id="cluster" length="all" >}}
@@ -278,7 +228,7 @@ The `tabs` shortcode takes these parameters:
278228
-->
279229
## 标签页
280230

281-
在本站的 markdown 页面(`.md` 文件)中,你可以加入一个标签页集来显示
231+
在本站的 Markdown 页面(`.md` 文件)中,你可以加入一个标签页集来显示
282232
某解决方案的不同形式。
283233

284234
标签页的短代码包含以下参数:
@@ -398,6 +348,124 @@ println "This is tab 2."
398348
{{< tab name="JSON File" include="podtemplate.json" />}}
399349
{{< /tabs >}}
400350

351+
<!--
352+
## Version strings
353+
354+
To generate a version string for inclusion in the documentation, you can choose from
355+
several version shortcodes. Each version shortcode displays a version string derived from
356+
the value of a version parameter found in the site configuration file, `config.toml`.
357+
The two most commonly used version parameters are `latest` and `version`.
358+
-->
359+
## 版本号信息
360+
361+
文档中的版本号信息可以通过短代码的方式生成。在配置文件 `config.toml` 中,定义了一些版本号信息,通过短代码及版本号参数可以从配置文件中提取并展示指定的版本号信息。
362+
最常见的版本号短代码参数包括 `latest``version`
363+
364+
<!--
365+
### `{{</* param "version" */>}}`
366+
367+
The `{{</* param "version" */>}}` shortcode generates the value of the current version of
368+
the Kubernetes documentation from the `version` site parameter. The `param` shortcode accepts the name of one site parameter, in this case: `version`.
369+
-->
370+
### `{{</* param "version" */>}}`
371+
372+
`{{</* param "version" */>}}` 短代码可以转换为 Kubernetes 文档的当前版本,具体的版本号来源于配置文件中的 `version` 参数。
373+
短代码 `param` 允许传入一个配置参数,例子里的参数为 `version`
374+
375+
<!--
376+
{{< note >}}
377+
In previously released documentation, `latest` and `version` parameter values are not equivalent.
378+
After a new version is released, `latest` is incremented and the value of `version` for the documentation set remains unchanged. For example, a previously released version of the documentation displays `version` as
379+
`v1.19` and `latest` as `v1.20`.
380+
{{< /note >}}
381+
-->
382+
{{< note >}}
383+
在先前已经发布的文档中,`latest``version` 参数转换得到的版本号并不相同。
384+
新版本文档发布后,参数 `latest` 会增加,而 `version` 则保持不变。例如,在上一版本的文档中使用 `version` 会得到 `v1.19`,而使用 `latest` 则会得到 `v1.20`
385+
{{< /note >}}
386+
387+
<!--
388+
Renders to:
389+
390+
{{< param "version" >}}
391+
-->
392+
转换为:
393+
394+
{{< param "version" >}}
395+
396+
<!--
397+
### `{{</* latest-version */>}}`
398+
399+
The `{{</* latest-version */>}}` shortcode returns the value of the `latest` site parameter.
400+
The `latest` site parameter is updated when a new version of the documentation is released.
401+
This parameter does not always match the value of `version` in a documentation set.
402+
403+
Renders to:
404+
405+
{{< latest-version >}}
406+
-->
407+
### `{{</* latest-version */>}}`
408+
409+
`{{</* latest-version */>}}` 会转换为配置文件中参数 `latest` 对应的值。每当有新版本文档发布时,该参数均会更新。
410+
因此,参数 `latest``version` 并不总是相同。
411+
412+
转换为:
413+
414+
{{< latest-version >}}
415+
416+
<!--
417+
### `{{</* latest-semver */>}}`
418+
419+
The `{{</* latest-semver */>}}` shortcode generates the value of `latest` without the "v" prefix.
420+
421+
Renders to:
422+
423+
{{< latest-semver >}}
424+
-->
425+
### `{{</* latest-semver */>}}`
426+
427+
`{{</* latest-semver */>}}` 会转换为配置文件中参数 `latest` 对应的值,并且会删除前缀 `v`
428+
429+
转换为:
430+
431+
{{< latest-semver >}}
432+
433+
<!--
434+
### `{{</* version-check */>}}`
435+
436+
The `{{</* version-check */>}}` shortcode checks if the `min-kubernetes-server-version`
437+
page parameter is present and then uses this value to compare to `version`.
438+
439+
Renders to:
440+
441+
{{< version-check >}}
442+
-->
443+
### `{{</* version-check */>}}`
444+
445+
`{{</* version-check */>}}` 会检查是否设置了页面参数 `min-kubernetes-server-version` 并将其与 `version` 进行比较。
446+
447+
转换为:
448+
449+
{{< version-check >}}
450+
451+
<!--
452+
### `{{</* latest-release-notes */>}}`
453+
454+
The `{{</* latest-release-notes */>}}` shortcode generates a version string from `latest` and removes
455+
the "v" prefix. The shortcode prints a new URL for the release note CHANGELOG page with the modified version string.
456+
457+
Renders to:
458+
459+
{{< latest-release-notes >}}
460+
-->
461+
### `{{</* latest-release-notes */>}}`
462+
463+
`{{</* latest-release-notes */>}}` 会转换为 `latest` 版本的更新日志的超链接。
464+
465+
转换为:
466+
467+
{{< latest-release-notes >}}
468+
401469
## {{% heading "whatsnext" %}}
402470

403471
<!--
@@ -408,7 +476,7 @@ println "This is tab 2."
408476
* Learn about [advanced contributing](/docs/contribute/advanced/).
409477
-->
410478

411-
* 了解 [Hugo](https://gohugo.io/)
479+
* 了解[Hugo](https://gohugo.io/)
412480
* 了解[撰写新的话题](/zh/docs/contribute/style/write-new-topic/)
413481
* 了解[使用页面内容类型](/zh/docs/contribute/style/page-content-types/)
414482
* 了解[发起 PR](/zh/docs/contribute/new-content/open-a-pr/)

0 commit comments

Comments
 (0)