@@ -5,16 +5,16 @@ linkTitle: 本地化
55weight : 25
66default_lang_commit : adf1731535b21711a7fba3cf46bd6bf4e7b923ee # patched
77drifted_from_default : true
8- cSpell:ignore : shortcodes
8+ cSpell:ignore : Dowair shortcodes
99---
1010
1111OTel 网站使用 Hugo 的 [ multilingual framework] 来支持页面的本地化。
1212英语是默认语言,而美式英语是默认的本地化语言形式。
13- 随着其他语言的本地化的增加,您可以从顶部导航栏中的语言下拉菜单中看到这些语言 。
13+ 随着其他语言的本地化的增加,你可以从顶部导航栏中的语言下拉菜单中看到这些语言 。
1414
1515## 翻译指南 {#translation-guidance}
1616
17- 当翻译英文网站页面时,我们建议您遵循本部分中提供的指南 。
17+ 当翻译英文网站页面时,我们建议你遵循本部分中提供的指南 。
1818
1919### 概要 {#summary}
2020
@@ -27,9 +27,10 @@ OTel 网站使用 Hugo 的 [multilingual framework] 来支持页面的本地化
2727 - Mermaid [ diagram] ( #images ) 文本字段
2828 - 代码片段内的注释(可选)
2929 - [ 前端元数据] [ front matter ] 中的 ` title ` 、` linkTitle ` 和 ` description ` 的字段值
30- - ** 所有页面** 内容和前置元数据,除非另有说明。
31- - 保留原文的** 内容** 、** 含义** 以及** 风格** 。
32- - 如果您有任何疑问或问题,请通过以下方式** 咨询** [ 维护人员] [ Maintainers ] :
30+ - ** 所有页面** 内容和前置元数据,除非另有说明
31+ - 保留原文的** 内容** 、** 含义** 以及** 风格**
32+ - ** 渐进式** 提交[ 小的 PR] ( #small-prs )
33+ - 如果你有任何疑问或问题,请通过以下方式** 咨询** [ 维护人员] [ Maintainers ] :
3334 - [ Slack] 上的 ` #otel-docs-localization ` 或 ` #otel-comms ` 频道
3435 - [ Discussion] 、Issue 或者 PR 评论
3536
@@ -250,72 +251,182 @@ npm run check:i18n -- -c HEAD <新文件的路径>
250251
251252若要获取该脚本的更多详细信息,请运行 ` npm run check:i18n -- -h ` .
252253
253- ## 新的本地化内容 {#new-localizations}
254+ ## 新增本地化语言 {#new-localizations}
254255
255- 要为 OpenTelemetry 网站开启一项新的本地化工作,你可以[ 创建一个issue] ( https://github.com/open-telemetry/opentelemetry.io/issues/ )
256- 来表明你参与贡献的意愿。同时,标记出所有愿意撰写和审核你想添加语言的翻译内容的人员。
257- 你至少需要两名潜在贡献者,理想情况下是三名。此外,在你的议题中还需包含以下任务列表:
256+ 对在 OTel 网站上新增一个本地化语言感兴趣?请联系维护者表达你的兴趣,例如通过 GitHub 讨论或
257+ Slack 的 ` #otel-docs-localization ` 频道。本节将解释如果新增一个本地化语言所需的步骤。
258258
259- ``` markdown
260- - [ ] Contributors for the new language: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ...
261- - [ ] Localize site homepage to YOUR_LANGUAGE_NAME
262- - [ ] Create an issue label for `lang:LANG_ID`
263- - [ ] Create org-level group for `LANG_ID` approvers
264- - [ ] Update components owners for `content/LANG_ID`
265- - [ ] Set up spell checking, if a cSpell dictionary is available
266- ```
259+ {{% alert title="注意" %}}
260+
261+ 你不必是 OpenTelemetry 项目的现有贡献者即可启动新的本地化语言。然而,
262+ 在满足[ 成员指南] ( https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md )
263+ 中关于成为正式成员和 Approver 的要求之前,你还不能被添加为
264+ [ OpenTelemetry GitHub 组织] ( https://github.com/open-telemetry/ ) 的成员,或成为本地化项目的 Approver 组成员。
265+
266+ 在你获得 Approver 资格之前,你可以通过添加 “LGTM”(Looks Good To Me)评论来表示你对某个本地化
267+ PR 的认可。在此启动阶段,维护者会将你的评论视为正式审批。
268+
269+ {{% /alert %}}
270+
271+ ### 1. 组建本地化团队 {#team}
272+
273+ 新增一个本地化语言的核心是建立一个积极且互助的社区。要为 OpenTelemetry 网站启动一个新的本地化语言,你需要:
274+
275+ 1 . 一位熟悉目标语言的 ** 本地化导师** ,例如 [ CNCF 术语表] ( https://glossary.cncf.io/ ) 或
276+ [ Kubernetes 网站] ( https://github.com/kubernetes/website ) 的[ 活跃 Approver] ( https://github.com/cncf/glossary/blob/main/CODEOWNERS ) 。
277+ 2 . 至少两位潜在的贡献者。
278+
279+ ### 2. 启动本地化:创建一个 Issue {#kickoff}
267280
268- 注意:
281+ 当你的 [ 本地化团队 ] ( #team ) 已经建立或正在组建时,创建一个包含以下任务列表的 Issue:
269282
270- - 对于想要添加的语言的 ` LANG_ID ` ,请使用官方的 [ ISO 639-1 编码] ( https://en.wikipedia.org/wiki/ISO_639-1 )
271- - 请查找 [ cSpell 词典] ( https://github.com/streetsidesoftware/cspell-dicts ) ,并确认以
272- NPM 包形式提供的 [ @cspell/dict -LANG_ID] ( https://www.npmjs.com/search?q=%40cspell%2Fdict )
273- 是否可用。如果没有适合您所指的方言或地区的词典,请选择最接近该地区的词典。有关设置方法的示例,请参考 [ PR #5386 ] 。
283+ 1 . 查找你要添加的语言的官方 [ ISO 639-1 语言代码] ( https://en.wikipedia.org/wiki/ISO_639-1 ) 。
284+ 我们将在本节的其余部分中将此语言代码称为 ` LANG_ID ` 。
285+ 如果你对使用哪个标签(尤其是子区域)有疑问,请咨询维护者。
274286
275- 当你创建了那个 Issue 并且聚集了所需数量的贡献者后,
276- 维护人员会要求你创建一个包含[ 索引页面] ( https://github.com/open-telemetry/opentelemetry.io/blob/main/content/en/_index.md )
277- 翻译内容的 PR。请确保维护人员能够编辑该PR,以便为该 PR 添加启动本地化项目所需的额外修改内容。
287+ 2 . 确定[ 导师和潜在贡献者] ( #team ) 的 GitHub 用户名。
278288
279- 在你的第一个 PR 被合并后,维护人员会负责设置 Issue 标签、组织级别的群组以及组件负责人。
289+ 3 . 创建一个 [ 新 Issue] ( https://github.com/open-telemetry/opentelemetry.io/issues/new ) ,
290+ 并在提交的 Issue 评论中包含以下任务列表:
280291
281- {{% alert title="重要" color="warning" %}}
292+ ``` markdown
293+ - [ ] Language info:
294+ - ISO 639-1 language code: `LANG_ID`
295+ - Language name: ADD_NAME_HERE
296+ - [ ] Locale team info:
297+ - [ ] Locale mentor: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ...
298+ - [ ] Contributors: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ...
299+ - [ ] Read through
300+ [Localization](https://opentelemetry.io/docs/contributing/localization/)
301+ and all other pages in the Contributing section
302+ - [ ] Localize site homepage (only) to YOUR_LANGUAGE_NAME and submit a PR.
303+ For details, see
304+ [Localize the homepage](https://opentelemetry.io/docs/contributing/localization/#homepage).
305+ - [ ] OTel maintainers:
306+ - [ ] Update Hugo config for `LANG_ID`
307+ - [ ] Configure cSpell and other tooling support
308+ - [ ] Create an issue label for `lang:LANG_ID`
309+ - [ ] Create org-level group for `LANG_ID` approvers
310+ - [ ] Update components owners for `content/LANG_ID`
311+ - [ ] Create an issue to track the localization of the **glossary**. Add the
312+ issue number here. For details, see
313+ [Localize the glossary](https://opentelemetry.io/docs/contributing/localization/#glossary).
314+ ```
282315
283- 即便你并非 OpenTelemetry 项目的现有贡献者,也能开启新的本地化工作。
284- 不过,你不会被添加为[ OpenTelemetry GitHub组织] ( https://github.com/open-telemetry/ ) 的成员,
285- 也无法成为你所负责本地化工作的审批组的成员。若要成为正式成员和审批人员,
286- 你需要满足[ 成员准则] ( https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md ) 中所列出的要求。
316+ ### 3. 本地化首页 {#homepage}
287317
288- 在启动本地化项目时,维护人员会像对待已有的审批人员那样对待你的审核意见。
318+ [ 提交一个 PR] ( ../pull-requests/ ) ,在文件 ` content/LANG_ID/_index.md `
319+ 中添加网站[ 首页] ( https://github.com/open-telemetry/opentelemetry.io/blob/main/content/en/_index.md ) 的翻译,
320+ 且** 不要包含其他内容** 。请确保维护者有权编辑你的 PR,因为他们需要添加一些额外更改以新增本地化语言。
321+
322+ 在你的第一个 PR 合并后,维护者将设置 Issue 标签、组织群组和组件所有者。
323+
324+ ### 4. 本地化术语表 {#glossary}
325+
326+ 第二个需要本地化的页面是[ 术语表] ( /docs/concepts/glossary/ ) 。
327+ 这是面向本地化读者的一个** 关键** 页面,因为它定义了可观测性及 OpenTelemetry 中的核心术语。
328+ 尤其当你的语言中不存在这些术语时,这一点尤为重要。
329+
330+ 参考 Ali Dowair 在 Write the Docs 2024 上的演讲主题[ 翻译艺术:如何本地化技术内容] ( https://www.writethedocs.org/conf/atlantic/2024/speakers/#speaker-ali-dowair-what-s-in-a-word-lessons-from-localizing-kubernetes-documentation-to-arabic-ali-dowair ) 及其[ 演讲视频] ( https://youtu.be/HY3LZOQqdig ) 。
331+
332+ ### 5. 按小步推进本地化其他页面 {#rest}
333+
334+ 在术语体系确立后,你可以开始本地化网站的其他页面。<a name =" small-prs " ></a >
335+
336+ {{% alert title="请提交小型 PR" color="primary" %}}
337+
338+ 本地化团队应** 以小步迭代的方式** 提交工作。也就是说,保持 [ PRs] 简洁,最好只包含一个或几个小文件。
339+ 小型 PR 更易于审查,因此通常能更快合并。
289340
290341{{% /alert %}}
291342
292- ## 英语语言维护者指南 {#english-language-maintainer-guidance}
343+ ### OTel 维护者清单
344+
345+ #### Hugo
346+
347+ 为 ` LANG_ID ` 更新 Hugo 配置。为 ` LANG_ID ` 添加合适条目:
348+
349+ - ` config/_default/hugo.yaml ` 中的 ` languages `
350+ - ` config/_default/module-template.yaml ` 中的 ` module.mounts `
351+ 至少应添加一个针对 ` content ` 的 ` source ` -` target ` 项。
352+ 仅当该语言内容足够多时,再考虑为 ` en ` 添加回退页面条目。
353+
354+ #### 拼写检查
355+
356+ 查找是否存在作为 NPM 包发布的 [ cSpell 字典] [ cSpell dictionaries ] [ @cspell/dict -LANG_ID] [ ] 。
357+ 如果没有适合你方言或地区的字典,请选择最接近的地区版本。
358+
359+ 如果完全没有可用字典,可以跳过本节。否则:
360+
361+ - 将该 NPM 包添加为开发依赖,例如:
362+ ` npm install --save-dev @cspell/dict-bn `
363+ - 创建 ` .cspell/LANG_ID-words.txt ` 文件,作为 ` LANG_ID ` 的站点本地词典。
364+ - 在 ` .cspell.yml ` 中添加以下条目:
365+ - ` import `
366+ - ` dictionaryDefinitions `
367+ - ` dictionaries ` :这里应添加两个条目,一个为 ` LANG_ID ` ,另一个为 ` LANG_ID-words.txt `
368+
369+ [ cSpell dictionaries ] : https://github.com/streetsidesoftware/cspell-dicts
370+ [ @cspell/dict-LANG_ID ] : https://www.npmjs.com/search?q=%40cspell%2Fdict
371+
372+ #### 其他工具支持
373+
374+ - ** Prettier 支持** :如果 Prettier 对 ` LANG_ID ` 支持不佳,请在 ` .prettierignore ` 中添加忽略规则。
375+
376+ ## Approver 与维护者指南 {#approver-and-maintainer-guidance}
377+
378+ ### 含语义变更的 PR 不应跨语言提交 {#prs-should-not-span-locales}
379+
380+ Approver 应确保对文档页面进行** 语义变更** 的 [ PRs] 不跨多个语言版本。
381+ 语义变更是指影响页面** 内容含义** 的修改。我们的文档[ 本地化流程] ( . ) 确保每种语言的
382+ Approver 会在适当的时候审查英文修改,以确定是否适用于其本地化版本,并决定如何整合。
383+
384+ 如有需要,Approver 将通过各自语言的 PR 进行修改。
385+
386+ ### 纯编辑性修改可跨语言提交 {#patch-locale-links}
387+
388+ ** 纯编辑性修改** 是指不影响内容含义的更新,可跨语言进行。这类修改包括:
389+
390+ - ** 链接维护** :修复因页面移动或删除而导致的链接路径错误;
391+ - ** 资源更新** :更新已移动的外部资源链接;
392+ - ** 定向内容添加** :在不便更新整个文件时,为已偏移的文件添加特定新定义或段落。
393+
394+ #### 链接修复与资源更新 {#link-fixes-and-resource-updates}
395+
396+ 例如,当英文文档页面移动或删除时,可能导致其他语言版本的链接检查失败。
397+ 此时,请在每个受影响页面中进行以下更新:
398+
399+ - 更新到新页面路径的链接引用;
400+ - 在 front matter 中的 ` default_lang_commit ` 行末添加注释 ` # patched ` ;
401+ - 不做其他修改;
402+ - 重新运行 ` npm run check:links ` 并确保无链接错误。
403+
404+ 当一个** 外部链接** 指向的资源(例如 GitHub 文件)被** 移动** 但语义** 未改变** 时,可考虑:
405+
406+ - 从 refcache 中移除失效链接;
407+ - 按前述方式更新所有语言版本的链接。
293408
294- ### 当非英语页面的链接检查失败时 {#when-link-checking-fails-for-non-english-pages }
409+ #### 向已偏移文件中添加定向内容 {#targeted-content-additions }
295410
296- 英语是 OpenTelemetry 网站的默认语言。在添加、编辑或重构英语文档之后,非英语页面的链接检查可能会失败 。
297- 如果出现这种情况,请执行以下操作:
411+ 当需要向与英文版本不完全同步的本地化文件中添加新内容时,可选择 ** 定向更新 ** ,而无需更新整个文件 。
412+ 例如,当英文术语表新增 “cardinality” 词条时,你可以仅在本地化版本中添加该定义。
298413
299- <!-- markdownlint-disable blanks-around-fences -->
414+ 操作流程示例:
300415
301- - 请不要修复这些链接。每个非英语页面都与对应的英语页面的特定提交相关联,
302- 该提交由 ` default_lang_commit ` 前端元数据键的 git 提交哈希值来标识。
303- - 通过将以下内容添加到页面的前端元数据中,来配置链接检查器以忽略非英语页面。
304- 如果有多个页面存在链接错误,则将其添加到最近的公共父级文件中:
305- ``` yaml
306- htmltest :
307- # TODO: remove the IgnoreDirs once broken links are fixed
308- IgnoreDirs :
309- - path-regex/to/non-en/directory/contain/files/to/ignore
310- - path-2-etc
311- ` ` `
312- - 运行 ` npm run check:links` 命令,并在你的 PR 中包含对 `.htmltest.yml` 配置文件所做的任何更新内容。
416+ - 仅将 “cardinality” 定义块添加至本地化术语表文件;
417+ - 在 front matter 中的 ` default_lang_commit ` 行末添加 ` # patched ` ;
418+ - 保留其他内容不变;
419+ - 在 PR 描述中明确说明:
420+ - 添加的具体内容(例如 “cardinality” 定义);
421+ - 文件中仍存在未同步内容;
422+ - 定向更新的理由(例如“为本地读者提供关键新术语,无需同步整个文件”)。
313423
314- <!-- markdownlint-enable blanks-around-fences -->
424+ 这种方式可实现对本地化内容的渐进改进,同时保持对同步状态的可见性。
315425
316426[ front matter ] : https://gohugo.io/content-management/front-matter/
317427[ main ] : https://github.com/open-telemetry/opentelemetry.io/commits/main/
318428[ maintainers ] : https://github.com/orgs/open-telemetry/teams/docs-maintainers
319429[ multilingual framework ] : https://gohugo.io/content-management/multilingual/
320- [PR # 5386]: https://github.com/open-telemetry/opentelemetry.io/pull/5386/files
430+ [ new issue ] : https://github.com/open-telemetry/opentelemetry.io/issues/new
431+ [ PRs ] : ../pull-requests/
321432[ slack ] : https://slack.cncf.io/
0 commit comments