diff --git a/pkg/util/i18n/i18n.go b/pkg/util/i18n/i18n.go index d3eae738..526389ae 100644 --- a/pkg/util/i18n/i18n.go +++ b/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/pkg/util/i18n/translations/README.md b/pkg/util/i18n/translations/README.md index a63381a7..6318ffe6 100644 --- a/pkg/util/i18n/translations/README.md +++ b/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: