diff --git a/hack/update-translations.sh b/hack/update-translations.sh index aba316c13bb..fe4d3700f2c 100755 --- a/hack/update-translations.sh +++ b/hack/update-translations.sh @@ -21,6 +21,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/util.sh" +TRANSLATIONS="staging/src/k8s.io/kubectl/pkg/util/i18n/translations" KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go" generate_pot="false" @@ -71,7 +72,7 @@ if [[ "${generate_pot}" == "true" ]]; then perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot kube::util::ensure-temp-dir if msgcat -s tmp.pot > "${KUBE_TEMP}/template.pot"; then - mv "${KUBE_TEMP}/template.pot" translations/kubectl/template.pot + mv "${KUBE_TEMP}/template.pot" "${TRANSLATIONS}/kubectl/template.pot" rm tmp.pot else echo "Failed to update template.pot" @@ -81,12 +82,10 @@ fi if [[ "${generate_mo}" == "true" ]]; then echo "Generating .po and .mo files" - for x in translations/*/*/*/*.po; do + for x in "${TRANSLATIONS}"/*/*/*/*.po; do msgcat -s "${x}" > tmp.po mv tmp.po "${x}" echo "generating .mo file for: ${x}" msgfmt "${x}" -o "$(dirname "${x}")/$(basename "${x}" .po).mo" done fi - -./hack/generate-bindata.sh diff --git a/translations/OWNERS b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/OWNERS similarity index 100% rename from translations/OWNERS rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/OWNERS diff --git a/translations/README.md b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md similarity index 83% rename from translations/README.md rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md index af058e2727c..a63381a7478 100644 --- a/translations/README.md +++ b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md @@ -5,7 +5,7 @@ This is a basic sketch of the workflow needed to add translations: # Adding/Updating Translations ## New languages -Create `translations/kubectl//LC_MESSAGES/k8s.po`. There's +Create `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl//LC_MESSAGES/k8s.po`. There's no need to update `translations/test/...` which is only used for unit tests. There is an example [PR here](https://github.com/kubernetes/kubernetes/pull/40645) which adds support for French. @@ -14,7 +14,7 @@ Once you've added a new language, you'll need to register it in `staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go` by adding it to the `knownTranslations` map. ## Wrapping strings -There is a simple script in `translations/extract.py` that performs +There is a simple script in `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py` that performs simple regular expression based wrapping of strings. It can always use improvements to understand additional strings. @@ -31,7 +31,7 @@ will extract and sort any new strings. ## Adding new translations Edit the appropriate `k8s.po` file, `poedit` is a popular open source tool -for translations. You can load the `translations/kubectl/template.pot` file +for translations. You can load the `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/template.pot` file to find messages that might be missing. Once you are done with your `k8s.po` file, generate the corresponding `k8s.mo` @@ -55,7 +55,7 @@ binaries. ## Extracting strings -There is a script in `translations/extract.py` that knows how to do some +There is a script in `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py` that knows how to do some simple extraction. It needs a lot of work. # Using translations diff --git a/translations/extract.py b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py similarity index 100% rename from translations/extract.py rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py diff --git a/translations/kubectl/OWNERS b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/OWNERS similarity index 100% rename from translations/kubectl/OWNERS rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/OWNERS diff --git a/translations/kubectl/de_DE/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/de_DE/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/de_DE/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/de_DE/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/de_DE/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/de_DE/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/de_DE/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/de_DE/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/default/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/default/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/default/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/default/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/en_US/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/en_US/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/en_US/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/en_US/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/fr_FR/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/fr_FR/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/fr_FR/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/fr_FR/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/fr_FR/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/fr_FR/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/fr_FR/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/fr_FR/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/it_IT/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/it_IT/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/it_IT/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/it_IT/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/it_IT/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/it_IT/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/it_IT/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/it_IT/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/ja_JP/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ja_JP/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/ja_JP/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ja_JP/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/ja_JP/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ja_JP/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/ja_JP/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ja_JP/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/ko_KR/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ko_KR/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/ko_KR/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ko_KR/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/ko_KR/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ko_KR/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/ko_KR/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/ko_KR/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/pt_BR/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/pt_BR/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/pt_BR/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/pt_BR/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/pt_BR/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/pt_BR/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/pt_BR/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/pt_BR/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/template.pot b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/template.pot similarity index 100% rename from translations/kubectl/template.pot rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/template.pot diff --git a/translations/kubectl/zh_CN/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_CN/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/zh_CN/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_CN/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/zh_CN/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_CN/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/zh_CN/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_CN/LC_MESSAGES/k8s.po diff --git a/translations/kubectl/zh_TW/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_TW/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/kubectl/zh_TW/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_TW/LC_MESSAGES/k8s.mo diff --git a/translations/kubectl/zh_TW/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_TW/LC_MESSAGES/k8s.po similarity index 100% rename from translations/kubectl/zh_TW/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/zh_TW/LC_MESSAGES/k8s.po diff --git a/translations/test/default/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/default/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/test/default/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/default/LC_MESSAGES/k8s.mo diff --git a/translations/test/default/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/default/LC_MESSAGES/k8s.po similarity index 100% rename from translations/test/default/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/default/LC_MESSAGES/k8s.po diff --git a/translations/test/en_US/LC_MESSAGES/k8s.mo b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/en_US/LC_MESSAGES/k8s.mo similarity index 100% rename from translations/test/en_US/LC_MESSAGES/k8s.mo rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/en_US/LC_MESSAGES/k8s.mo diff --git a/translations/test/en_US/LC_MESSAGES/k8s.po b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/en_US/LC_MESSAGES/k8s.po similarity index 100% rename from translations/test/en_US/LC_MESSAGES/k8s.po rename to staging/src/k8s.io/kubectl/pkg/util/i18n/translations/test/en_US/LC_MESSAGES/k8s.po