kubectl: use embedded translations instead of generated bindata
Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com> Kubernetes-commit: eb75b34394964fbc325ca08a5d0b126c5ea16b6f
This commit is contained in:
		
							parent
							
								
									f52da0a0a3
								
							
						
					
					
						commit
						e99a037812
					
				|  | @ -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 | ||||
| 		} | ||||
|  |  | |||
|  | @ -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: | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue