Skip to content

Commit 79628d3

Browse files
authored
Merge pull request #4807 from medyagh/translation2
Adding translating formatting
2 parents e373639 + 186d241 commit 79628d3

File tree

10 files changed

+195
-168
lines changed

10 files changed

+195
-168
lines changed

cmd/minikube/cmd/config/disable.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ var addonsDisableCmd = &cobra.Command{
2828
Long: "Disables the addon w/ADDON_NAME within minikube (example: minikube addons disable dashboard). For a list of available addons use: minikube addons list ",
2929
Run: func(cmd *cobra.Command, args []string) {
3030
if len(args) != 1 {
31-
exit.Usage("usage: minikube addons disable ADDON_NAME")
31+
exit.UsageT("usage: minikube addons disable ADDON_NAME")
3232
}
3333

3434
addon := args[0]
3535
err := Set(addon, "false")
3636
if err != nil {
3737
exit.WithError("disable failed", err)
3838
}
39-
console.Success("%s was successfully disabled", addon)
39+
console.SuccessT(`"{{.minikube_addon}}" was successfully disabled`, console.Arg{"minikube_addon": addon})
4040
},
4141
}
4242

cmd/minikube/cmd/config/profile.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ var ProfileCmd = &cobra.Command{
3636
Run: func(cmd *cobra.Command, args []string) {
3737
if len(args) == 0 {
3838
profile := viper.GetString(pkgConfig.MachineProfile)
39-
console.OutLn("%s", profile)
39+
console.OutT(console.Empty, profile)
4040
os.Exit(0)
4141
}
4242

4343
if len(args) > 1 {
44-
exit.Usage("usage: minikube profile [MINIKUBE_PROFILE_NAME]")
44+
exit.UsageT("usage: minikube profile [MINIKUBE_PROFILE_NAME]")
4545
}
4646

4747
profile := args[0]
@@ -55,19 +55,19 @@ var ProfileCmd = &cobra.Command{
5555
cc, err := pkgConfig.Load()
5656
// might err when loading older version of cfg file that doesn't have KeepContext field
5757
if err != nil && !os.IsNotExist(err) {
58-
console.ErrLn("Error loading profile config: %v", err)
58+
console.ErrT(console.Sad, `Error loading profile config: {{.error}}`, console.Arg{"error": err})
5959
}
6060
if err == nil {
6161
if cc.MachineConfig.KeepContext {
62-
console.Success("Skipped switching kubectl context for %s , because --keep-context", profile)
63-
console.Success("To connect to this cluster, use: kubectl --context=%s", profile)
62+
console.SuccessT("Skipped switching kubectl context for {{.profile_name}} , because --keep-context", console.Arg{"profile_name": profile})
63+
console.SuccessT("To connect to this cluster, use: kubectl --context={{.profile_name}}", console.Arg{"profile_name": profile})
6464
} else {
6565
err := pkgutil.SetCurrentContext(constants.KubeconfigPath, profile)
6666
if err != nil {
67-
console.ErrLn("Error while setting kubectl current context : %v", err)
67+
console.ErrT(console.Sad, `Error while setting kubectl current context : {{.error}}`, console.Arg{"error": err})
6868
}
6969
}
7070
}
71-
console.Success("minikube profile was successfully set to %s", profile)
71+
console.SuccessT("minikube profile was successfully set to {{.profile_name}}", console.Arg{"profile_name": profile})
7272
},
7373
}

cmd/minikube/cmd/delete.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ associated files.`,
4747
// runDelete handles the executes the flow of "minikube delete"
4848
func runDelete(cmd *cobra.Command, args []string) {
4949
if len(args) > 0 {
50-
exit.Usage("usage: minikube delete")
50+
exit.UsageT("usage: minikube delete")
5151
}
5252
profile := viper.GetString(pkg_config.MachineProfile)
5353
api, err := machine.NewAPIClient()
@@ -58,7 +58,7 @@ func runDelete(cmd *cobra.Command, args []string) {
5858

5959
cc, err := pkg_config.Load()
6060
if err != nil && !os.IsNotExist(err) {
61-
console.ErrLn("Error loading profile config: %v", err)
61+
console.ErrT(console.Sad, "Error loading profile config: {{.error}}", console.Arg{"name": profile})
6262
}
6363

6464
// In the case of "none", we want to uninstall Kubernetes as there is no VM to delete
@@ -76,17 +76,17 @@ func runDelete(cmd *cobra.Command, args []string) {
7676
}
7777

7878
if err := cmdUtil.KillMountProcess(); err != nil {
79-
console.Fatal("Failed to kill mount process: %v", err)
79+
console.FatalT("Failed to kill mount process: {{.error}}", console.Arg{"error": err})
8080
}
8181

8282
if err := os.RemoveAll(constants.GetProfilePath(viper.GetString(pkg_config.MachineProfile))); err != nil {
8383
if os.IsNotExist(err) {
84-
console.OutStyle(console.Meh, "%q profile does not exist", profile)
84+
console.OutT(console.Meh, `"{{.profile_name}}" profile does not exist`, console.Arg{"profile_name": profile})
8585
os.Exit(0)
8686
}
8787
exit.WithError("Failed to remove profile", err)
8888
}
89-
console.OutStyle(console.Crushed, "The %q cluster has been deleted.", profile)
89+
console.OutT(console.Crushed, `The "{{.cluster_name}}" cluster has been deleted.`, console.Arg{"cluster_name": profile})
9090

9191
machineName := pkg_config.GetMachineName()
9292
if err := pkgutil.DeleteKubeConfigContext(constants.KubeconfigPath, machineName); err != nil {
@@ -95,12 +95,12 @@ func runDelete(cmd *cobra.Command, args []string) {
9595
}
9696

9797
func uninstallKubernetes(api libmachine.API, kc pkg_config.KubernetesConfig, bsName string) {
98-
console.OutStyle(console.Resetting, "Uninstalling Kubernetes %s using %s ...", kc.KubernetesVersion, bsName)
98+
console.OutT(console.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", console.Arg{"kubernetes_version": kc.KubernetesVersion, "bootstrapper_name": bsName})
9999
clusterBootstrapper, err := getClusterBootstrapper(api, bsName)
100100
if err != nil {
101-
console.ErrLn("Unable to get bootstrapper: %v", err)
101+
console.ErrT(console.Empty, "Unable to get bootstrapper: {{.error}}", console.Arg{"error": err})
102102
} else if err = clusterBootstrapper.DeleteCluster(kc); err != nil {
103-
console.ErrLn("Failed to delete cluster: %v", err)
103+
console.ErrT(console.Empty, "Failed to delete cluster: {{.error}}", console.Arg{"error": err})
104104
}
105105
}
106106

cmd/minikube/cmd/ip.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var ipCmd = &cobra.Command{
4242
if err != nil {
4343
switch err := errors.Cause(err).(type) {
4444
case mcnerror.ErrHostDoesNotExist:
45-
exit.WithCode(exit.NoInput, "%q host does not exist, unable to show an IP", config.GetMachineName())
45+
exit.WithCodeT(exit.NoInput, `"{{.profile_name}}" host does not exist, unable to show an IP`, console.Arg{"profile_name": config.GetMachineName()})
4646
default:
4747
exit.WithError("Error getting host", err)
4848
}
@@ -51,7 +51,7 @@ var ipCmd = &cobra.Command{
5151
if err != nil {
5252
exit.WithError("Error getting IP", err)
5353
}
54-
console.OutLn(ip)
54+
console.Out(ip)
5555
},
5656
}
5757

0 commit comments

Comments
 (0)