@@ -19,7 +19,7 @@ dropdown menu in the top nav.
19
19
20
20
## Keeping track of localized page drift {#track-changes}
21
21
22
- One of the main challenges of maintaining localized pages is identifying when
22
+ One of the main challenges of maintaining localized pages, is identifying when
23
23
the corresponding English language pages have been updated. This section
24
24
explains how we handle this.
25
25
@@ -28,19 +28,21 @@ explains how we handle this.
28
28
When a localized page is written, such as ` content/zh/<some-path>/page.md ` , this
29
29
translation is based on a specific [ ` main ` branch commit] [ main ] of the
30
30
corresponding English language version of the page at
31
- ` content/en/<some-path>/page.md ` . Every localized page identifies this commit in
32
- the page's front matter as follows:
31
+ ` content/en/<some-path>/page.md ` . In this repository, every localized page
32
+ identifies the English page commit in the localized page's front matter as
33
+ follows:
33
34
34
35
``` markdown
35
36
---
36
37
title: Your localized page title
37
38
...
38
39
39
- ## default_lang_commit: <commit-hash-of-main-for-default-language-page>
40
+ default_lang_commit: <commit-hash-of-main-for-default-language-page>
40
41
```
41
42
42
43
The front matter above would be in ` content/zh/<some-path>/page.md ` . The commit
43
- corresponds to the latest commit of ` content/en/<some-path>/page.md ` in ` main ` .
44
+ would correspond to the latest commit of ` content/en/<some-path>/page.md ` in
45
+ ` main ` .
44
46
45
47
### Tracking changes to English pages
46
48
@@ -49,25 +51,26 @@ corresponding localized pages that need updating by running the following
49
51
command:
50
52
51
53
``` console
52
- $ scripts/i18n- check.sh
54
+ $ npm run check:i18n
53
55
1 1 content/en/docs/kubernetes/_index.md - content/zh/docs/kubernetes/_index.md
54
56
...
55
57
```
56
58
57
- Specify the path to your localization to restrict the output, for example:
59
+ You can restrict the target pages to one or more localizations by providing
60
+ path(s) like this:
58
61
59
62
``` sh
60
- scripts/ i18n-check.sh content/zh
63
+ npm run check: i18n -- content/zh
61
64
```
62
65
63
66
### Viewing change details
64
67
65
68
For any given localized pages that need updating, you can see the diff details
66
69
of the corresponding English language pages by using the ` -d ` flag and providing
67
- the paths to your localized pages. For example:
70
+ the paths to your localized pages, or omit the paths to see all . For example:
68
71
69
72
``` console
70
- $ scripts/ i18n-check.sh -d content/zh/docs/kubernetes
73
+ $ npm run check: i18n -- -d content/zh/docs/kubernetes
71
74
diff --git a/content/en/docs/kubernetes/_index.md b/content/en/docs/kubernetes/_index.md
72
75
index 3592df5d..c7980653 100644
73
76
--- a/content/en/docs/kubernetes/_index.md
@@ -87,12 +90,20 @@ index 3592df5d..c7980653 100644
87
90
As you create pages for your localization, remember to add ` default_lang_commit `
88
91
to the page front matter along with an appropriate commit hash from ` main ` .
89
92
90
- If your translation is based on an English page in ` main ` at ` HEAD ` , then run
91
- the following command to automatically add ` default_lang_commit ` to your page
92
- file's front matter using the commit hash at ` HEAD ` :
93
+ If your page translation is based on an English page in ` main ` at ` <hash> ` , then
94
+ run the following command to automatically add ` default_lang_commit ` to your
95
+ page file's front matter using the commit ` <hash> ` . You can specify ` HEAD ` as an
96
+ argument if your pages are now synced with ` main ` at ` HEAD ` . For example:
93
97
94
98
``` sh
95
- scripts/i18n-check.sh -u < PATH-TO-YOUR-NEW-FILES>
99
+ npm run check:i18n -- -n -c 1ca30b4d content/ja
100
+ npm run check:i18n -- -n -c HEAD content/zh/docs/concepts
101
+ ```
102
+
103
+ To list localization page files with missing hash keys, run:
104
+
105
+ ``` sh
106
+ npm run check:i18n -- -n
96
107
```
97
108
98
109
### Updating ` default_lang_commit ` for existing pages
@@ -105,11 +116,32 @@ commit hash.
105
116
106
117
If your localized page now corresponds to the English language version in ` main `
107
118
at ` HEAD ` , then erase the commit hash value in the front matter, and run the
108
- update command given in the previous section to automatically refresh the
119
+ ** add ** command given in the previous section to automatically refresh the
109
120
` default_lang_commit ` field value.
110
121
111
122
{{% /alert %}}
112
123
124
+ If you have batch updated all of your localization pages that had drifted, you
125
+ can update the commit hash of these files using the ` -u ` flag followed by a
126
+ commit hash or 'HEAD' to use ` main@HEAD ` .
127
+
128
+ ``` sh
129
+ npm run check:i18n -- -c < hash> < PATH-TO-YOUR-NEW-FILES>
130
+ npm run check:i18n -- -c HEAD < PATH-TO-YOUR-NEW-FILES>
131
+ ```
132
+
133
+ {{% alert title="Important" %}}
134
+
135
+ When you use ` HEAD ` as a hash specifier, the script will use the hash of ` main `
136
+ at HEAD in your ** local environment** . Make sure that you fetch and pull ` main ` ,
137
+ if you want HEAD to correspond to ` main ` in GitHub.
138
+
139
+ {{% /alert %}}
140
+
141
+ ### Script help
142
+
143
+ For more details about the script, run ` npm run check:i18n -- -h ` .
144
+
113
145
## New localizations
114
146
115
147
(Section To Be Completed soon with information about how to propose a new
0 commit comments