Add translation files into the minikube binary
parent
550218e7ee
commit
12bb8c5c25
|
@ -34,6 +34,7 @@ _testmain.go
|
|||
deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/etc/VERSION
|
||||
|
||||
/pkg/minikube/assets/assets.go
|
||||
/pkg/minikube/translate/translations.go
|
||||
/minikube
|
||||
|
||||
.DS_Store
|
||||
|
|
17
Makefile
17
Makefile
|
@ -106,7 +106,7 @@ out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE)
|
|||
out/minikube-windows-amd64.exe: out/minikube-windows-amd64
|
||||
cp out/minikube-windows-amd64 out/minikube-windows-amd64.exe
|
||||
|
||||
out/minikube-%: pkg/minikube/assets/assets.go $(shell find $(CMD_SOURCE_DIRS) -type f -name "*.go")
|
||||
out/minikube-%: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go $(shell find $(CMD_SOURCE_DIRS) -type f -name "*.go")
|
||||
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
|
||||
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
|
||||
else
|
||||
|
@ -157,11 +157,11 @@ iso_in_docker:
|
|||
--user $(shell id -u):$(shell id -g) --env HOME=/tmp --env IN_DOCKER=1 \
|
||||
$(ISO_BUILD_IMAGE) /bin/bash
|
||||
|
||||
test-iso: pkg/minikube/assets/assets.go
|
||||
test-iso: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
|
||||
go test -v ./test/integration --tags=iso --minikube-args="--iso-url=file://$(shell pwd)/out/buildroot/output/images/rootfs.iso9660"
|
||||
|
||||
.PHONY: test-pkg
|
||||
test-pkg/%: pkg/minikube/assets/assets.go
|
||||
test-pkg/%: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
|
||||
go test -v -test.timeout=60m ./$* --tags="$(MINIKUBE_BUILD_TAGS)"
|
||||
|
||||
.PHONY: all
|
||||
|
@ -183,7 +183,7 @@ integration-versioned: out/minikube
|
|||
go test -v -test.timeout=60m ./test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS) versioned" $(TEST_ARGS)
|
||||
|
||||
.PHONY: test
|
||||
test: pkg/minikube/assets/assets.go
|
||||
test: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
|
||||
./test.sh
|
||||
|
||||
# Regenerates assets.go when template files have been updated
|
||||
|
@ -191,6 +191,10 @@ pkg/minikube/assets/assets.go: $(shell find deploy/addons -type f)
|
|||
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
|
||||
PATH="$(PATH):$(GOPATH)/bin" go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
|
||||
|
||||
pkg/minikube/translate/translations.go: $(shell find translations/ -type f)
|
||||
which go-bindata || GO111MODULE=off GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...
|
||||
PATH="$(PATH):$(GOPATH)/bin" go-bindata -nomemcopy -o pkg/minikube/translate/translations.go -pkg translate translations/...
|
||||
|
||||
.PHONY: cross
|
||||
cross: out/minikube-linux-$(GOARCH) out/minikube-darwin-amd64 out/minikube-windows-amd64.exe
|
||||
|
||||
|
@ -210,6 +214,7 @@ checksum:
|
|||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -f pkg/minikube/assets/assets.go
|
||||
rm -f pkg/minikube/translate/translations.go
|
||||
rm -rf ./vendor
|
||||
|
||||
.PHONY: gendocs
|
||||
|
@ -241,7 +246,7 @@ out/linters/golangci-lint:
|
|||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b out/linters $(GOLINT_VERSION)
|
||||
|
||||
.PHONY: lint
|
||||
lint: pkg/minikube/assets/assets.go out/linters/golangci-lint
|
||||
lint: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go out/linters/golangci-lint
|
||||
./out/linters/golangci-lint run \
|
||||
--deadline 4m \
|
||||
--build-tags "${MINIKUBE_INTEGRATION_BUILD_TAGS}" \
|
||||
|
@ -259,7 +264,7 @@ reportcard:
|
|||
mdlint:
|
||||
@$(MARKDOWNLINT) $(MINIKUBE_MARKDOWN_FILES)
|
||||
|
||||
out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go
|
||||
out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go
|
||||
go run -ldflags="$(MINIKUBE_LDFLAGS)" hack/help_text/gen_help_text.go
|
||||
|
||||
out/minikube_$(DEB_VERSION).deb: out/minikube-linux-amd64
|
||||
|
|
|
@ -18,7 +18,6 @@ package translate
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
|
||||
"github.com/cloudfoundry-attic/jibber_jabber"
|
||||
|
@ -74,8 +73,8 @@ func DetermineLocale() {
|
|||
}
|
||||
|
||||
// Load translations for preferred language into memory.
|
||||
translationFile := "pkg/minikube/translate/translations/" + preferredLanguage.String() + ".json"
|
||||
t, err := ioutil.ReadFile(translationFile)
|
||||
translationFile := "translations/" + preferredLanguage.String() + ".json"
|
||||
t, err := Asset(translationFile)
|
||||
if err != nil {
|
||||
glog.Infof("Failed to load translation file for %s: %v", preferredLanguage.String(), err)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue