Merge pull request #114053 from brianpursley/fix-update-translations

hack/update-translations.sh: Improve backslash handling
This commit is contained in:
Kubernetes Prow Robot 2023-05-23 09:06:29 -07:00 committed by GitHub
commit 12386e2de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 384 additions and 308 deletions

View File

@ -83,8 +83,7 @@ if [[ "${generate_pot}" == "true" ]]; then
# shellcheck disable=SC2046
go-xgettext -k=i18n.T $(grep -lr "i18n.T" "${KUBECTL_FILES[@]}" | grep -vE "${KUBECTL_IGNORE_FILES_REGEX}") > tmp.pot
perl -pi -e 's/CHARSET/UTF-8/' tmp.pot
perl -pi -e 's/\\\(/\\\\\(/g' tmp.pot
perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
perl -pi -e 's/\\(?!n"\n|")/\\\\/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"