@@ -11,90 +11,89 @@ localizations. English is the default language, with US English as the default
11
11
(implicit) localization. A growing number of other localizations are supported,
12
12
as can be seen from the languages dropdown menu in the top nav.
13
13
14
- ## English language maintainer guidance
14
+ ## Translation guidance
15
15
16
- ### When link checking fails for non-English pages
16
+ When translating website pages from English, we recommend that you follow the
17
+ guidance offered in this section.
17
18
18
- English is the default language of the OpenTelemetry website. After you add,
19
- edit, or reorganized English language documentation, link checking may fail for
20
- non-English pages. When this happens:
19
+ ### Summary / TL;DR {#summary}
21
20
22
- <!-- markdownlint-disable blanks-around-fences -->
21
+ Do translate:
23
22
24
- - Do ** not** fix the broken links. Each non-English page is associated with a
25
- specific commit of the corresponding English page, as identified by the git
26
- commit hash value of the ` default_lang_commit ` front matter key.
27
- - Configure the link checker to ignore the non-English pages by adding the
28
- following to the page's front matter, or to the closest common ancestor file,
29
- when more than one page has link errors:
30
- ``` yaml
31
- htmltest :
32
- # TODO: remove the IgnoreDirs once broken links are fixed
33
- IgnoreDirs :
34
- - path-regex/to/non-en/directory/contain/files/to/ignore
35
- - path-2-etc
36
- ` ` `
37
- - Run ` npm run check:links` and include any updates to the `.htmltest.yml`
38
- config file with your PR.
23
+ - [ Front matter] [ ] fields ` title ` , ` linkTitle ` , and ` description `
24
+ - Page content, including the text fields in Mermaid [ diagrams] ( #images )
39
25
40
- <!-- markdownlint-enable blanks-around-fences -->
26
+ Do ** NOT ** :
41
27
42
- # # Translation guidance
28
+ - Translate:
29
+ - ** File or directory** names of resources in this repository
30
+ - [ Links] ( #links ) , this includes [ heading IDs] ( #headings ) .[ ^ * ]
31
+ - [ Front matter] [ ] fields other than those listed in the "Do" section above.
32
+ In particular, do not translate ` aliases ` . When in doubt, ask maintainers.
33
+ - Create ** copies of images** , unless you [ localize text in the images] ( #images )
43
34
44
- We recommend that you follow the guidance offered in this section when
45
- translating pages.
35
+ [ ^ * ] : For a possible exception, see [ Links] ( #links ) .
46
36
47
- # ## Heading anchors
37
+ ### Heading IDs {#headings}
48
38
49
39
To ensure that heading anchor targets are uniform across localizations, when
50
40
translating headings:
51
41
52
- - Preserve the heading's explicit ID if it has one. [Heading ID syntax] is
42
+ - Preserve the heading's explicit ID if it has one. [ Heading ID syntax] [ ] is
53
43
written after the heading text using syntax like ` { #some-id } ` .
54
44
- Otherwise, explicitly declare a heading ID corresponding to the autogenerated
55
45
ID of the original English heading.
56
46
57
- {{% alert title="Note" %}}
58
-
59
- We leave it to the discretion of localization authors to decide if they add an
60
- explicit heading ID to all headings of translated pages, or whether this is only
61
- done for known intra-site heading targets, as reported by the link checker. The
62
- former option is more uniform and more work. It better supports having
63
- site-external targets into localization pages and avoids having to revisit
64
- previously translated pages as new heading targets are used.
65
-
66
- {{% /alert %}}
67
-
68
47
[ Heading ID syntax] :
69
48
https://github.com/yuin/goldmark/blob/master/README.md#headings
70
49
71
- # ## Links
50
+ ### Links {#links}
72
51
73
- For link references to local paths (as opposed to external links), preserve the
74
- path _as is_. This holds true for links to website pages or section-local
75
- resources such as images.
52
+ Do ** not** translate link references. This holds true for external links, and
53
+ paths to website pages and section-local resources such as [ images] ( #images ) .
54
+
55
+ The only exception is for links to external pages (such as
56
+ < https://en.wikipedia.org > ) that have a version specific to your local. Often
57
+ this means replacing the ` en ` in the URL by your locale's language code.
76
58
77
59
{{% alert title="Note" %}}
78
60
79
61
The OTel website repository has a custom render-link hook that Hugo uses to
80
- convert ** absolute link paths to documentation pages**. Links of the form
81
- ` /docs/some-page` are made locale specific by prefixing the path with the page
82
- language code when rendering the link. For example, the previous sample path
83
- would become `/ja/docs/some-page` when rendered from a Japanese page.
62
+ convert absolute link paths referring to documentation pages. ** Links of the
63
+ form ` /docs/some-page ` are made locale specific** by prefixing the path with the
64
+ page language code when rendering the link. For example, the previous sample
65
+ path would become ` /ja/docs/some-page ` when rendered from a Japanese page.
84
66
85
67
{{% /alert %}}
86
68
87
- # ## Images
69
+ ### Images and diagrams {#images}
70
+
71
+ Do ** not** make copies of image files unless you localize text in the image
72
+ itself[ ^ shared-images ] .
88
73
89
- Hugo is smart in the way that it renders page images that are shared across site
90
- localizations. That is, in the generated site folder, Hugo will output a
91
- _single_ image file that is then shared across localizations.
74
+ ** Do** translate text in [ Mermaid] [ ] diagrams.
92
75
93
- So as a general rule, _do not_ make copies of image files in your localization
94
- unless you actually change the image.
76
+ [ ^ shared-images ] :
77
+ Hugo is smart about the way that it renders image files that are shared
78
+ across site localizations. That is, Hugo will output a _ single_ image file
79
+ and share it across locales.
80
+
81
+ [ Mermaid ] : https://mermaid.js.org
82
+
83
+ ### Include files {#includes}
84
+
85
+ ** Do** translate page fragments found under ` _includes ` directories just as you
86
+ would translate any other page content.
95
87
96
88
### Shortcodes
97
89
90
+ {{% alert title="Note" %}}
91
+
92
+ As of February 2025, we are in the process of migrating from shortcodes to
93
+ [ include files] ( #includes ) as a means of supporting shared-page content.
94
+
95
+ {{% /alert %}}
96
+
98
97
Some of the base shortcodes contain English text that you might need to localize
99
98
-- this is particularly true of those contained in [ layouts/shortcodes/docs] .
100
99
@@ -123,14 +122,14 @@ follows:
123
122
``` markdown
124
123
---
125
124
title: Your localized page title
126
- ...
127
-
128
- default_lang_commit: <commit-hash-of-main-for-default-language-page>
125
+ # ...
126
+ default_lang_commit: <most-recent-commit-hash-of-default-language-page>
127
+ ---
129
128
```
130
129
131
130
The front matter above would be in ` content/zh/<some-path>/page.md ` . The commit
132
- would correspond to the latest commit of `content/en/<some-path>/page.md` in
133
- ` main` .
131
+ hash would correspond to the latest commit of ` content/en/<some-path>/page.md `
132
+ from the ` main ` branch .
134
133
135
134
### Tracking changes to English pages
136
135
@@ -285,6 +284,35 @@ if you are an approver already.
285
284
286
285
{{% /alert %}}
287
286
287
+ ## English-language maintainer guidance
288
+
289
+ ### When link checking fails for non-English pages
290
+
291
+ English is the default language of the OpenTelemetry website. After you add,
292
+ edit, or reorganized English language documentation, link checking may fail for
293
+ non-English pages. When this happens:
294
+
295
+ <!-- markdownlint-disable blanks-around-fences -->
296
+
297
+ - Do ** not** fix the broken links. Each non-English page is associated with a
298
+ specific commit of the corresponding English page, as identified by the git
299
+ commit hash value of the ` default_lang_commit ` front matter key.
300
+ - Configure the link checker to ignore the non-English pages by adding the
301
+ following to the page's front matter, or to the closest common ancestor file,
302
+ when more than one page has link errors:
303
+ ``` yaml
304
+ htmltest :
305
+ # TODO: remove the IgnoreDirs once broken links are fixed
306
+ IgnoreDirs :
307
+ - path-regex/to/non-en/directory/contain/files/to/ignore
308
+ - path-2-etc
309
+ ` ` `
310
+ - Run ` npm run check:links` and include any updates to the `.htmltest.yml`
311
+ config file with your PR.
312
+
313
+ <!-- markdownlint-enable blanks-around-fences -->
314
+
315
+ [front matter] : https://gohugo.io/content-management/front-matter/
288
316
[main] : https://github.com/open-telemetry/opentelemetry.io/commits/main/
289
317
[multilingual framework] : https://gohugo.io/content-management/multilingual/
290
318
[PR # 5386]: https://github.com/open-telemetry/opentelemetry.io/pull/5386/files
0 commit comments