Skip to content

Commit 88f993b

Browse files
committed
Add verify-spelling.sh for ja content
We have the translation guideline as [1], and that contains what are valid Japanese words for the corresponding English words. This adds a script to verify those words based on the guideline. [1]: https://kubernetes.io/ja/docs/contribute/localization/
1 parent 07371c3 commit 88f993b

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

scripts/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| `lsync.sh` | This script checks if the English version of a page has changed since a localized page has been committed. |
1313
| `replace-capture.sh` | This script sets K8S_WEBSITE in your env to your docs website root or rely on this script to determine it automatically |
1414
| `check-ctrlcode.py` | This script finds control-code(0x00-0x1f) in text files. |
15+
| `ja/verify-spelling.sh` | This script finds Japanese words that are against the guideline. |
1516

1617

1718

@@ -177,4 +178,13 @@ The output is following format.
177178
{2} : The column number that a control-code exists.
178179
{3} : The found control-code.
179180
{4} : The one-line strings in the file.
180-
```
181+
```
182+
183+
## ja/verify-spelling.sh
184+
185+
This script finds Japanese words that are against the guideline[1]
186+
[1] https://kubernetes.io/ja/docs/contribute/localization/#%E9%A0%BB%E5%87%BA%E5%8D%98%E8%AA%9E
187+
188+
```
189+
Usage: ./ja/verify-spelling.sh
190+
```

scripts/ja/OWNERS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See the OWNERS docs at https://go.k8s.io/owners
2+
3+
# This is the localization project for Japanese.
4+
# Teams and members are visible at https://github.com/orgs/kubernetes/teams.
5+
6+
reviewers:
7+
- sig-docs-ja-reviews
8+
9+
approvers:
10+
- sig-docs-ja-owners
11+
12+
labels:
13+
- language/ja

scripts/ja/verify-spelling.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2022 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
##########
17+
18+
# cd to the root path
19+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
20+
CONTENT_DIR="content/ja"
21+
cd "${ROOT}/${CONTENT_DIR}"
22+
23+
TARGET_WORDS="" # invalid:valid
24+
TARGET_WORDS="${TARGET_WORDS} コンテナー:コンテナ"
25+
TARGET_WORDS="${TARGET_WORDS} アーキテクチャー:アーキテクチャ"
26+
TARGET_WORDS="${TARGET_WORDS} コントローラ[^ー]:コントローラー"
27+
TARGET_WORDS="${TARGET_WORDS} オペレータ[^ー]:オペレーター"
28+
TARGET_WORDS="${TARGET_WORDS} パラメータ[^ー]:パラメーター"
29+
30+
INVALID_CONTAINED=""
31+
32+
for word_set in $(echo ${TARGET_WORDS})
33+
do
34+
invalid=$(echo ${word_set} | awk -F: '{print $1}')
35+
valid=$(echo ${word_set} | awk -F: '{print $2}')
36+
grep -E "${invalid}" * -R
37+
if [ $? -eq 0 ]; then
38+
echo "Invalid word ${invalid} is contained under ${CONTENT_DIR}."
39+
echo "Please replace ${invalid} with ${valid}."
40+
echo
41+
INVALID_CONTAINED="TRUE"
42+
fi
43+
done
44+
45+
if [ "${INVALID_CONTAINED}" != "" ]; then
46+
exit 1
47+
fi

0 commit comments

Comments
 (0)