Skip to content

Commit 2e487f8

Browse files
committed
docs: translated contributing/localization into ja
1 parent 99f0ae5 commit 2e487f8

File tree

1 file changed

+282
-0
lines changed

1 file changed

+282
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
---
2+
title: サイトのローカリゼーション
3+
description: 非英語ローカリゼーションのサイトページの作成と管理
4+
linkTitle: ローカリゼーション
5+
weight: 25
6+
default_lang_commit: 99f0ae5760038d51f9e9eb376bb428a2caca8167
7+
cSpell:ignore: shortcodes
8+
---
9+
10+
OTel のウェブサイトは、ページのローカリゼーションをサポートするために、Hugo の [multilingual framework] をサポートしています。
11+
デフォルトの言語は英語であり、米国英語がデフォルト(暗黙の)ローカリゼーションとして設定されています。
12+
対応する言語の数は増えており、トップナビゲーションの言語ドロップダウンメニューから確認できます。
13+
14+
## 英語メンテナーガイド
15+
16+
### 非英語ページのリンクチェックが失敗したとき
17+
18+
英語は OpenTelemetry ウェブサイトのデフォルト言語です。
19+
英語のドキュメントを追加、編集、再構成した後に、非英語ページのリンクチェックが失敗する可能性があります。
20+
そのような場合は、以下を実行してください。
21+
22+
<!-- markdownlint-disable blanks-around-fences -->
23+
24+
- リンクを**修正しないでください**。それぞれの非英語ページは対応する英語のページの特定のコミット(フロントマターキーである `default_lang_commit` の Git コミットハッシュ)に関連づけられています。
25+
- 以下のフロントマター、1 つの以上のページがリンクエラーが発生している場合は最も近い祖先のファイルに非英語ページを無視するようにリンクチェッカーを設定してください。
26+
```yaml
27+
htmltest:
28+
# TODO: remove the IgnoreDirs once broken links are fixed
29+
IgnoreDirs:
30+
- path-regex/to/non-en/directory/contain/files/to/ignore
31+
- path-2-etc
32+
```
33+
- `npm run check:links` を実行して、設定ファイル `.htmltest.yml` への変更を PR に含めてください。
34+
35+
<!-- markdownlint-enable blanks-around-fences -->
36+
37+
## 翻訳ガイダンス
38+
39+
ページの翻訳の際には、本セクションのガイドに従うことを推奨します。
40+
41+
### Heading anchors
42+
43+
To ensure that heading anchor targets are uniform across localizations, when
44+
translating headings:
45+
46+
- Preserve the heading's explicit ID if it has one. [Heading ID syntax] is
47+
written after the heading text using syntax like `{ #some-id }`.
48+
- Otherwise, explicitly declare a heading ID corresponding to the autogenerated
49+
ID of the original English heading.
50+
51+
{{% alert title="Note" %}}
52+
53+
We leave it to the discretion of localization authors to decide if they add an
54+
explicit heading ID to all headings of translated pages, or whether this is only
55+
done for known intra-site heading targets, as reported by the link checker. The
56+
former option is more uniform and more work. It better supports having
57+
site-external targets into localization pages and avoids having to revisit
58+
previously translated pages as new heading targets are used.
59+
60+
{{% /alert %}}
61+
62+
[Heading ID syntax]: https://github.com/yuin/goldmark/blob/master/README.md#headings
63+
64+
### Links
65+
66+
For link references to local paths (as opposed to external links), preserve the
67+
path _as is_. This holds true for links to website pages or section-local
68+
resources such as images.
69+
70+
{{% alert title="Note" %}}
71+
72+
The OTel website repository has a custom render-link hook that Hugo uses to
73+
convert **absolute link paths to documentation pages**. Links of the form
74+
`/docs/some-page` are made locale specific by prefixing the path with the page
75+
language code when rendering the link. For example, the previous sample path
76+
would become `/ja/docs/some-page` when rendered from a Japanese page.
77+
78+
{{% /alert %}}
79+
80+
### Images
81+
82+
Hugo is smart in the way that it renders page images that are shared across site
83+
localizations. That is, in the generated site folder, Hugo will output a
84+
_single_ image file that is then shared across localizations.
85+
86+
So as a general rule, _do not_ make copies of image files in your localization
87+
unless you actually change the image.
88+
89+
### Shortcodes
90+
91+
Some of the base shortcodes contain English text that you might need to localize
92+
-- this is particularly true of those contained in [layouts/shortcodes/docs].
93+
94+
If you need to create a localized version of a shortcode, place it under
95+
`layouts/shortcodes/xx`, where `xx` is your localization's language code. From
96+
there, use the same relative path as the original base shortcode.
97+
98+
[layouts/shortcodes/docs]: https://github.com/open-telemetry/opentelemetry.io/tree/main/layouts/shortcodes/docs
99+
100+
## Keeping track of localized-page drift {#track-changes}
101+
102+
One of the main challenges of maintaining localized pages, is identifying when
103+
the corresponding English language pages have been updated. This section
104+
explains how we handle this.
105+
106+
### The `default_lang_commit` front-matter field
107+
108+
When a localized page is written, such as `content/zh/<some-path>/page.md`, this
109+
translation is based on a specific [`main` branch commit][main] of the
110+
corresponding English language version of the page at
111+
`content/en/<some-path>/page.md`. In this repository, every localized page
112+
identifies the English page commit in the localized page's front matter as
113+
follows:
114+
115+
```markdown
116+
---
117+
title: Your localized page title
118+
...
119+
120+
default_lang_commit: <commit-hash-of-main-for-default-language-page>
121+
```
122+
123+
The front matter above would be in `content/zh/<some-path>/page.md`. The commit
124+
would correspond to the latest commit of `content/en/<some-path>/page.md` in
125+
`main`.
126+
127+
### Tracking changes to English pages
128+
129+
As updates are made to English language pages, you can keep track of the
130+
corresponding localized pages that need updating by running the following
131+
command:
132+
133+
```console
134+
$ npm run check:i18n
135+
1 1 content/en/docs/platforms/kubernetes/_index.md - content/zh/docs/platforms/kubernetes/_index.md
136+
...
137+
```
138+
139+
You can restrict the target pages to one or more localizations by providing
140+
path(s) like this:
141+
142+
```sh
143+
npm run check:i18n -- content/zh
144+
```
145+
146+
### Viewing change details
147+
148+
For any given localized pages that need updating, you can see the diff details
149+
of the corresponding English language pages by using the `-d` flag and providing
150+
the paths to your localized pages, or omit the paths to see all. For example:
151+
152+
```console
153+
$ npm run check:i18n -- -d content/zh/docs/platforms/kubernetes
154+
diff --git a/content/en/docs/platforms/kubernetes/_index.md b/content/en/docs/platforms/kubernetes/_index.md
155+
index 3592df5d..c7980653 100644
156+
--- a/content/en/docs/platforms/kubernetes/_index.md
157+
+++ b/content/en/docs/platforms/kubernetes/_index.md
158+
@@ -1,7 +1,7 @@
159+
---
160+
title: OpenTelemetry with Kubernetes
161+
linkTitle: Kubernetes
162+
-weight: 11
163+
+weight: 350
164+
description: Using OpenTelemetry with Kubernetes
165+
---
166+
```
167+
168+
### Adding `default_lang_commit` to new pages
169+
170+
As you create pages for your localization, remember to add `default_lang_commit`
171+
to the page front matter along with an appropriate commit hash from `main`.
172+
173+
If your page translation is based on an English page in `main` at `<hash>`, then
174+
run the following command to automatically add `default_lang_commit` to your
175+
page file's front matter using the commit `<hash>`. You can specify `HEAD` as an
176+
argument if your pages are now synced with `main` at `HEAD`. For example:
177+
178+
```sh
179+
npm run check:i18n -- -n -c 1ca30b4d content/ja
180+
npm run check:i18n -- -n -c HEAD content/zh/docs/concepts
181+
```
182+
183+
To list localization page files with missing hash keys, run:
184+
185+
```sh
186+
npm run check:i18n -- -n
187+
```
188+
189+
### Updating `default_lang_commit` for existing pages
190+
191+
As you update your localized pages to match changes made to the corresponding
192+
English language page, ensure that you also update the `default_lang_commit`
193+
commit hash.
194+
195+
{{% alert title="Tip" %}}
196+
197+
If your localized page now corresponds to the English language version in `main`
198+
at `HEAD`, then erase the commit hash value in the front matter, and run the
199+
**add** command given in the previous section to automatically refresh the
200+
`default_lang_commit` field value.
201+
202+
{{% /alert %}}
203+
204+
If you have batch updated all of your localization pages that had drifted, you
205+
can update the commit hash of these files using the `-u` flag followed by a
206+
commit hash or 'HEAD' to use `main@HEAD`.
207+
208+
```sh
209+
npm run check:i18n -- -c <hash> <PATH-TO-YOUR-NEW-FILES>
210+
npm run check:i18n -- -c HEAD <PATH-TO-YOUR-NEW-FILES>
211+
```
212+
213+
{{% alert title="Important" %}}
214+
215+
When you use `HEAD` as a hash specifier, the script will use the hash of `main`
216+
at HEAD in your **local environment**. Make sure that you fetch and pull `main`,
217+
if you want HEAD to correspond to `main` in GitHub.
218+
219+
{{% /alert %}}
220+
221+
### Script help
222+
223+
For more details about the script, run `npm run check:i18n -- -h`.
224+
225+
## New localizations
226+
227+
To start a new localization for the OpenTelemetry website,
228+
[raise an issue](https://github.com/open-telemetry/opentelemetry.io/issues/) to
229+
share your interest to contribute. Tag all other individuals that are willing to
230+
write and review translations in the language you want to add. **You need at
231+
least two potential contributors**, ideally three. Include the following task
232+
list in your issue as well:
233+
234+
```markdown
235+
- [ ] Contributors for the new language: @GITHUB_HANDLE1, @GITHUB_HANDLE2, ...
236+
- [ ] Localize site homepage to YOUR_LANGUAGE_NAME
237+
- [ ] Create an issue label for `lang:LANG_ID`
238+
- [ ] Create org-level group for `LANG_ID` approvers
239+
- [ ] Update components owners for `content/LANG_ID`
240+
- [ ] Set up spell checking, if a cSpell dictionary is available
241+
```
242+
243+
Notes:
244+
245+
- For `LANG_ID`, use an official
246+
[ISO 639-1 code](https://en.wikipedia.org/wiki/ISO_639-1) for the language you
247+
want to add.
248+
- Look for
249+
[cSpell dictionaries](https://github.com/streetsidesoftware/cspell-dicts)
250+
available as NPM packages
251+
[@cspell/dict-LANG_ID](https://www.npmjs.com/search?q=%40cspell%2Fdict). If a
252+
dictionary isn't available for your dialect or region, choose the closest
253+
region. For an example of how to set this up, see [PR #5386].
254+
255+
After you created that issue and have the required amount of contributors,
256+
maintainers will ask you to provide a pull request with a translation of the
257+
[index page](https://github.com/open-telemetry/opentelemetry.io/blob/main/content/en/_index.md).
258+
Make sure that maintainers are allowed to edit your PR, since they will add
259+
additional changes to your PR that are required to get your localization project
260+
started.
261+
262+
With your first PR merged maintainers will take care of setting up the issue
263+
label, the org-level group and the component owners.
264+
265+
{{% alert title="Important" color="warning" %}}
266+
267+
You don't have to be an existing contributor to the OpenTelemetry project, to
268+
start a new localization. However you will not be added as a member of the
269+
[OpenTelemetry GitHub organization](https://github.com/open-telemetry/) or as a
270+
member of the approvers group for your localization. You will need to satisfy
271+
the requirements for becoming an established member and approver as outlined in
272+
the
273+
[membership guidelines](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md).
274+
275+
When starting the localization project, maintainers will treat your reviews as
276+
if you are an approver already.
277+
278+
{{% /alert %}}
279+
280+
[main]: https://github.com/open-telemetry/opentelemetry.io/commits/main/
281+
[multilingual framework]: https://gohugo.io/content-management/multilingual/
282+
[PR #5386]: https://github.com/open-telemetry/opentelemetry.io/pull/5386/files

0 commit comments

Comments
 (0)