mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
fix update-translations.sh
This commit is contained in:
parent
6acc62da75
commit
079d8aeb1e
@ -22,7 +22,12 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||||
|
|
||||||
TRANSLATIONS="staging/src/k8s.io/kubectl/pkg/util/i18n/translations"
|
TRANSLATIONS="staging/src/k8s.io/kubectl/pkg/util/i18n/translations"
|
||||||
KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go"
|
KUBECTL_FILES=()
|
||||||
|
KUBECTL_DEFAULT_LOCATIONS=(
|
||||||
|
"pkg/kubectl/cmd"
|
||||||
|
"staging/src/k8s.io/kubectl/pkg/cmd"
|
||||||
|
)
|
||||||
|
KUBECTL_IGNORE_FILES_REGEX="cmd/kustomize/kustomize.go"
|
||||||
|
|
||||||
generate_pot="false"
|
generate_pot="false"
|
||||||
generate_mo="false"
|
generate_mo="false"
|
||||||
@ -37,7 +42,7 @@ while getopts "hf:xg" opt; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
f)
|
f)
|
||||||
KUBECTL_FILES="${OPTARG}"
|
KUBECTL_FILES+=("${OPTARG}")
|
||||||
;;
|
;;
|
||||||
x)
|
x)
|
||||||
generate_pot="true"
|
generate_pot="true"
|
||||||
@ -52,6 +57,10 @@ while getopts "hf:xg" opt; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ ${#KUBECTL_FILES} -eq 0 ]]; then
|
||||||
|
KUBECTL_FILES+=("${KUBECTL_DEFAULT_LOCATIONS[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
if ! which go-xgettext > /dev/null; then
|
if ! which go-xgettext > /dev/null; then
|
||||||
echo 'Can not find go-xgettext, install with:'
|
echo 'Can not find go-xgettext, install with:'
|
||||||
echo 'go get github.com/gosexy/gettext/go-xgettext'
|
echo 'go get github.com/gosexy/gettext/go-xgettext'
|
||||||
@ -66,7 +75,8 @@ fi
|
|||||||
|
|
||||||
if [[ "${generate_pot}" == "true" ]]; then
|
if [[ "${generate_pot}" == "true" ]]; then
|
||||||
echo "Extracting strings to POT"
|
echo "Extracting strings to POT"
|
||||||
go-xgettext -k=i18n.T "${KUBECTL_FILES}" > tmp.pot
|
# 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/CHARSET/UTF-8/' tmp.pot
|
||||||
perl -pi -e 's/\\\(/\\\\\(/g' tmp.pot
|
perl -pi -e 's/\\\(/\\\\\(/g' tmp.pot
|
||||||
perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
|
perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
|
||||||
|
@ -38,14 +38,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
serviceaccountResources = `
|
serviceaccountResources = i18n.T(`replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset`)
|
||||||
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset`
|
|
||||||
|
|
||||||
serviceaccountLong = templates.LongDesc(i18n.T(`
|
serviceaccountLong = templates.LongDesc(i18n.T(`
|
||||||
Update ServiceAccount of pod template resources.
|
Update ServiceAccount of pod template resources.
|
||||||
|
|
||||||
Possible resources (case insensitive) can be:
|
Possible resources (case insensitive) can be:
|
||||||
` + serviceaccountResources))
|
|
||||||
|
`) + serviceaccountResources)
|
||||||
|
|
||||||
serviceaccountExample = templates.Examples(i18n.T(`
|
serviceaccountExample = templates.Examples(i18n.T(`
|
||||||
# Set Deployment nginx-deployment's ServiceAccount to serviceaccount1
|
# Set Deployment nginx-deployment's ServiceAccount to serviceaccount1
|
||||||
|
Loading…
Reference in New Issue
Block a user