diff --git a/staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go b/staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go index d3eae73896c..526389ae6d3 100644 --- a/staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go +++ b/staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go @@ -19,17 +19,19 @@ package i18n import ( "archive/zip" "bytes" + "embed" "errors" "fmt" "os" "strings" - "k8s.io/kubectl/pkg/generated" - "github.com/chai2010/gettext-go/gettext" "k8s.io/klog/v2" ) +//go:embed translations +var translations embed.FS + var knownTranslations = map[string][]string{ "kubectl": { "default", @@ -112,7 +114,7 @@ func LoadTranslations(root string, getLanguageFn func() string) error { if err != nil { return err } - data, err := generated.Asset(filename) + data, err := translations.ReadFile(filename) if err != nil { return err } diff --git a/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md index a63381a7478..6318ffe6277 100644 --- a/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md +++ b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/README.md @@ -42,6 +42,10 @@ We use the English translation as the `msgid`. ## Regenerating the bindata file +> Note: Regeneration of bindata is no more necessary for Kubernetes 1.22+ as +> the translations are now embedded into the binary at compile time. +> See: https://github.com/kubernetes/kubernetes/pull/99829 + With the `mo` files up to date, you can now convert the generated files into code using `go-bindata` command which can be installed with: