From ea7bc858c7344f189cac35661236c5301938f38a Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Mon, 15 Nov 2021 16:31:25 -0800 Subject: [PATCH] allow for fmt.Sprintf in Advice text --- pkg/minikube/extract/extract.go | 20 +++++++++++++++++++- translations/de.json | 4 +++- translations/es.json | 4 +++- translations/fr.json | 3 +++ translations/ja.json | 4 +++- translations/ko.json | 4 +++- translations/pl.json | 4 +++- translations/strings.txt | 4 +++- translations/zh-CN.json | 4 +++- 9 files changed, 43 insertions(+), 8 deletions(-) diff --git a/pkg/minikube/extract/extract.go b/pkg/minikube/extract/extract.go index d5b6013372..f0807f9dc9 100644 --- a/pkg/minikube/extract/extract.go +++ b/pkg/minikube/extract/extract.go @@ -542,7 +542,25 @@ func extractAdvice(f ast.Node, e *state) error { if i.Name == "Advice" { // At this point we know the value in the kvp is guaranteed to be a string - advice, _ := kvp.Value.(*ast.BasicLit) + advice, ok := kvp.Value.(*ast.BasicLit) + if !ok { + // Maybe the advice is a function call, like fmt.Sprintf + ad, ok := kvp.Value.(*ast.CallExpr) + if !ok { + // Ok, we tried. Abort. + return true + } + // Let's support fmt.Sprintf with a string argument only + adArg, ok := ad.Args[0].(*ast.BasicLit) + if !ok { + return true + } + s := checkString(adArg.Value) + if s != "" { + e.translations[s] = "" + } + return true + } s := checkString(advice.Value) if s != "" { e.translations[s] = "" diff --git a/translations/de.json b/translations/de.json index 94cda0e4cd..9972e0f6db 100644 --- a/translations/de.json +++ b/translations/de.json @@ -15,6 +15,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "", "- Restart your {{.driver_name}} service": "", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -80,6 +81,7 @@ "Cannot find directory {{.path}} for copy": "", "Cannot find directory {{.path}} for mount": "", "Cannot use both --output and --format options": "", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "", @@ -104,7 +106,6 @@ "Connect to LoadBalancer services": "", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -691,6 +692,7 @@ "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", "The {{.driver_name}} driver should not be used with root privileges.": "Der Treiber {{.driver_name}} sollte nicht mit Root-Rechten verwendet werden.", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "There's a new version for '{{.driver_executable}}'. Please consider upgrading. {{.documentation_url}}": "Es gibt eine neue Version für '{{.driver_executable}}'. Bitte erwägen Sie ein Upgrade. {{.documentation_url}}", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", diff --git a/translations/es.json b/translations/es.json index dbaec07f9e..862d432f83 100644 --- a/translations/es.json +++ b/translations/es.json @@ -16,6 +16,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "- Recorta las imágenes, volumenes, redes y contenedores abandonados de {{.driver_name}}.\n\n\t\t\t\t{{.driver_name}} system prune --volumes", "- Restart your {{.driver_name}} service": "- Reinicia el servicio {{.driver_name}}", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -81,6 +82,7 @@ "Cannot find directory {{.path}} for copy": "", "Cannot find directory {{.path}} for mount": "No se pudo encontrar el directorio {{.path}} para montar", "Cannot use both --output and --format options": "No se pueden usar ambas opciones (--output y --path)", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "Comprueba si tienes pods innecesarios corriendo, con el comando 'kubectl get pods -A'", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "Comprueba la salida de 'journalctl -xeu kubelet', intenta pasar --extra-config=kubelet.cgroup-driver=systemd a minikube start", @@ -105,7 +107,6 @@ "Connect to LoadBalancer services": "Conectar a los servicios LoadBalancer", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "Considera crear un cluster con más memoria usando `minikube start --memory CANT_MB`", "Consider increasing Docker Desktop's memory size.": "Considera incrementar la memoria asignada a Docker Desktop", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -697,6 +698,7 @@ "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", "The {{.driver_name}} driver should not be used with root privileges.": "El controlador {{.driver_name}} no se debe utilizar con privilegios de raíz.", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "There's a new version for '{{.driver_executable}}'. Please consider upgrading. {{.documentation_url}}": "Hay una nueva versión de \"{{.driver_executable}}\". Te recomendamos que realices la actualización. {{.documentation_url}}", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", diff --git a/translations/fr.json b/translations/fr.json index 931d8c2543..78e8d21b68 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -15,6 +15,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "- Nettoyer les images {{.driver_name}} non utilisées, les volumes, les réseaux et les conteneurs abandonnées.\n\n\t\t\t\t{{.driver_name}} system prune --volumes", "- Restart your {{.driver_name}} service": "- Redémarrer votre service {{.driver_name}}", "- {{.logPath}}": "- {{.logPath}}", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "la tranche de --kvm-numa-count est 1 à 8", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "le drapeau --network est valide uniquement avec les pilotes docker/podman et KVM, il va être ignoré", "127.0.0.1": "127.0.0.1", @@ -76,6 +77,7 @@ "Cannot find directory {{.path}} for copy": "Impossible de trouver le répertoire {{.path}} pour la copie", "Cannot find directory {{.path}} for mount": "Impossible de trouver le répertoire {{.path}} pour le montage", "Cannot use both --output and --format options": "Impossible d'utiliser à la fois les options --output et --format", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "Le certificat {{.certPath}} a expiré. Génération d'un nouveau...", "Check if you have unnecessary pods running by running 'kubectl get po -A": "Vérifiez si vous avez des pods inutiles en cours d'exécution en exécutant 'kubectl get po -A'", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "Vérifiez la sortie de 'journalctl -xeu kubelet', essayez de passer --extra-config=kubelet.cgroup-driver=systemd au démarrage de minikube", @@ -649,6 +651,7 @@ "The time interval for each check that wait performs in seconds": "L'intervalle de temps pour chaque contrôle que wait effectue en secondes", "The value passed to --format is invalid": "La valeur passée à --format n'est pas valide", "The value passed to --format is invalid: {{.error}}": "La valeur passée à --format n'est pas valide : {{.error}}", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "Ces paramètres --extra-config ne sont pas valides : {{.invalid_extra_opts}}", "These changes will take effect upon a minikube delete and then a minikube start": "Ces modifications prendront effet lors d'une suppression de minikube, puis d'un démarrage de minikube", "Things to try without Kubernetes ...": "Choses à essayer sans Kubernetes ...", diff --git a/translations/ja.json b/translations/ja.json index 329f7ecf75..60ce5e9057 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -17,6 +17,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "- 使用していない {{.driver_name}} イメージ、ボリューム、ネットワーク、コンテナーを削除してください。\n\n\t\t\t\t{{.driver_name}} system prune --volumes", "- Restart your {{.driver_name}} service": "{{.driver_name}} サービスを再起動してください", "- {{.logPath}}": "- {{.logPath}}", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "--kvm-numa-count の範囲は 1~8 です", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "--network フラグは、docker/podman および KVM ドライバーでのみ有効であるため、無視されます", "127.0.0.1": "127.0.0.1", @@ -80,6 +81,7 @@ "Cannot find directory {{.path}} for copy": "", "Cannot find directory {{.path}} for mount": "マウントのためのディレクトリ{{.path}}が見つかりません", "Cannot use both --output and --format options": "", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "", @@ -104,7 +106,6 @@ "Connect to LoadBalancer services": "LoadBalancer サービスに接続します", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -691,6 +692,7 @@ "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", "The {{.driver_name}} driver should not be used with root privileges.": "{{.driver_name}} ドライバをルート権限で使用しないでください", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "There's a new version for '{{.driver_executable}}'. Please consider upgrading. {{.documentation_url}}": "「{{.driver_executable}}」の新しいバージョンがあります。アップグレードを検討してください。{{.documentation_url}}", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", diff --git a/translations/ko.json b/translations/ko.json index 42cd2d29b6..e355e0edab 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -21,6 +21,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "", "- Restart your {{.driver_name}} service": "{{.driver_name}} 서비스를 다시 시작하세요", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "--kvm-numa-count 범위는 1부터 8입니다", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -85,6 +86,7 @@ "Cannot find directory {{.path}} for copy": "복사하기 위한 디렉토리 {{.path}} 를 찾을 수 없습니다.", "Cannot find directory {{.path}} for mount": "마운트하기 위한 디렉토리 {{.path}} 를 찾을 수 없습니다", "Cannot use both --output and --format options": "--output 과 --format 옵션을 함께 사용할 수 없습니다", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "", @@ -111,7 +113,6 @@ "Connect to LoadBalancer services": "", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -701,6 +702,7 @@ "The time interval for each check that wait performs in seconds": "", "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", "Things to try without Kubernetes ...": "", diff --git a/translations/pl.json b/translations/pl.json index 11a68e7099..909df8648a 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -20,6 +20,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "", "- Restart your {{.driver_name}} service": "", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -82,6 +83,7 @@ "Cannot find directory {{.path}} for copy": "Nie znaleziono katalogu {{.path}} do skopiowania", "Cannot find directory {{.path}} for mount": "Nie można odnaleźć folderu {{.path}} do zamontowania", "Cannot use both --output and --format options": "Nie można użyć obydwu opcji --output i --format jednocześnie", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "Sprawdź czy są uruchomione jakieś niepotrzebne pody za pomocą komendy: 'kubectl get pod -A' ", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "", @@ -108,7 +110,6 @@ "Connect to LoadBalancer services": "Połącz się do serwisów LoadBalancer'a", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "Rozważ przydzielenie większej ilości pamięci RAM dla programu Docker Desktop", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "Skopiuj dany plik do minikube", @@ -710,6 +711,7 @@ "The value passed to --format is invalid": "Wartość przekazana do --format jest nieprawidłowa", "The value passed to --format is invalid: {{.error}}": "Wartość przekazana do --format jest nieprawidłowa: {{.error}}", "The {{.driver_name}} driver should not be used with root privileges.": "{{.driver_name}} nie powinien być używany z przywilejami root'a.", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", "Things to try without Kubernetes ...": "", diff --git a/translations/strings.txt b/translations/strings.txt index d3010ce7b4..c11bea0f19 100644 --- a/translations/strings.txt +++ b/translations/strings.txt @@ -15,6 +15,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "", "- Restart your {{.driver_name}} service": "", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -76,6 +77,7 @@ "Cannot find directory {{.path}} for copy": "", "Cannot find directory {{.path}} for mount": "", "Cannot use both --output and --format options": "", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "", @@ -100,7 +102,6 @@ "Connect to LoadBalancer services": "", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -647,6 +648,7 @@ "The time interval for each check that wait performs in seconds": "", "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "", "Things to try without Kubernetes ...": "", diff --git a/translations/zh-CN.json b/translations/zh-CN.json index 2f8fc7147a..9b7593d920 100644 --- a/translations/zh-CN.json +++ b/translations/zh-CN.json @@ -22,6 +22,7 @@ "- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers.\n\n\t\t\t\t{{.driver_name}} system prune --volumes": "", "- Restart your {{.driver_name}} service": "- 重启你的 {{.driver_name}} 服务", "- {{.logPath}}": "", + "--container-runtime must be set to \\\"containerd\\\" or \\\"cri-o\\\" for rootless": "", "--kvm-numa-count range is 1-8": "", "--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "", "127.0.0.1": "", @@ -96,6 +97,7 @@ "Cannot find directory {{.path}} for copy": "", "Cannot find directory {{.path}} for mount": "找不到用来挂载的 {{.path}} 目录", "Cannot use both --output and --format options": "不能同时使用 --output 和 --format 选项", + "Cannot use the option --no-kubernetes on the {{.name}} driver": "", "Certificate {{.certPath}} has expired. Generating a new one...": "", "Check if you have unnecessary pods running by running 'kubectl get po -A": "", "Check output of 'journalctl -xeu kubelet', try passing --extra-config=kubelet.cgroup-driver=systemd to minikube start": "检查 'journalctl -xeu kubelet' 的输出,尝试启动 minikube 时添加参数 --extra-config=kubelet.cgroup-driver=systemd", @@ -127,7 +129,6 @@ "Connect to LoadBalancer services": "连接到 LoadBalancer 服务", "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ": "", "Consider increasing Docker Desktop's memory size.": "", - "Container runtime must be set to \\\"containerd\\\" for rootless": "", "Continuously listing/getting the status with optional interval duration.": "", "Control Plane could not update, try minikube delete --all --purge": "", "Copy the specified file into minikube": "", @@ -798,6 +799,7 @@ "The value passed to --format is invalid": "", "The value passed to --format is invalid: {{.error}}": "", "The {{.driver_name}} driver should not be used with root privileges.": "不应以根权限使用 {{.driver_name}} 驱动程序。", + "There are a couple ways to enable the required file sharing:\n1. Enable \"Use the WSL 2 based engine\" in Docker Desktop\nor\n2. Enable file sharing in Docker Desktop for the %s%s directory": "", "There's a new version for '{{.driver_executable}}'. Please consider upgrading. {{.documentation_url}}": "“{{.driver_executable}}”有一个新版本。请考虑升级。{{.documentation_url}}", "These --extra-config parameters are invalid: {{.invalid_extra_opts}}": "", "These changes will take effect upon a minikube delete and then a minikube start": "",