|
| 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