Skip to content

Commit

Permalink
Merge pull request #4807 from medyagh/translation2
Browse files Browse the repository at this point in the history
Adding translating formatting
  • Loading branch information
tstromberg authored Jul 19, 2019
2 parents e373639 + 186d241 commit 79628d3
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 168 deletions.
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/config/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ var addonsDisableCmd = &cobra.Command{
Long: "Disables the addon w/ADDON_NAME within minikube (example: minikube addons disable dashboard). For a list of available addons use: minikube addons list ",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
exit.Usage("usage: minikube addons disable ADDON_NAME")
exit.UsageT("usage: minikube addons disable ADDON_NAME")
}

addon := args[0]
err := Set(addon, "false")
if err != nil {
exit.WithError("disable failed", err)
}
console.Success("%s was successfully disabled", addon)
console.SuccessT(`"{{.minikube_addon}}" was successfully disabled`, console.Arg{"minikube_addon": addon})
},
}

Expand Down
14 changes: 7 additions & 7 deletions cmd/minikube/cmd/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ var ProfileCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
profile := viper.GetString(pkgConfig.MachineProfile)
console.OutLn("%s", profile)
console.OutT(console.Empty, profile)
os.Exit(0)
}

if len(args) > 1 {
exit.Usage("usage: minikube profile [MINIKUBE_PROFILE_NAME]")
exit.UsageT("usage: minikube profile [MINIKUBE_PROFILE_NAME]")
}

profile := args[0]
Expand All @@ -55,19 +55,19 @@ var ProfileCmd = &cobra.Command{
cc, err := pkgConfig.Load()
// might err when loading older version of cfg file that doesn't have KeepContext field
if err != nil && !os.IsNotExist(err) {
console.ErrLn("Error loading profile config: %v", err)
console.ErrT(console.Sad, `Error loading profile config: {{.error}}`, console.Arg{"error": err})
}
if err == nil {
if cc.MachineConfig.KeepContext {
console.Success("Skipped switching kubectl context for %s , because --keep-context", profile)
console.Success("To connect to this cluster, use: kubectl --context=%s", profile)
console.SuccessT("Skipped switching kubectl context for {{.profile_name}} , because --keep-context", console.Arg{"profile_name": profile})
console.SuccessT("To connect to this cluster, use: kubectl --context={{.profile_name}}", console.Arg{"profile_name": profile})
} else {
err := pkgutil.SetCurrentContext(constants.KubeconfigPath, profile)
if err != nil {
console.ErrLn("Error while setting kubectl current context : %v", err)
console.ErrT(console.Sad, `Error while setting kubectl current context : {{.error}}`, console.Arg{"error": err})
}
}
}
console.Success("minikube profile was successfully set to %s", profile)
console.SuccessT("minikube profile was successfully set to {{.profile_name}}", console.Arg{"profile_name": profile})
},
}
16 changes: 8 additions & 8 deletions cmd/minikube/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ associated files.`,
// runDelete handles the executes the flow of "minikube delete"
func runDelete(cmd *cobra.Command, args []string) {
if len(args) > 0 {
exit.Usage("usage: minikube delete")
exit.UsageT("usage: minikube delete")
}
profile := viper.GetString(pkg_config.MachineProfile)
api, err := machine.NewAPIClient()
Expand All @@ -58,7 +58,7 @@ func runDelete(cmd *cobra.Command, args []string) {

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

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

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

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var ipCmd = &cobra.Command{
if err != nil {
switch err := errors.Cause(err).(type) {
case mcnerror.ErrHostDoesNotExist:
exit.WithCode(exit.NoInput, "%q host does not exist, unable to show an IP", config.GetMachineName())
exit.WithCodeT(exit.NoInput, `"{{.profile_name}}" host does not exist, unable to show an IP`, console.Arg{"profile_name": config.GetMachineName()})
default:
exit.WithError("Error getting host", err)
}
Expand All @@ -51,7 +51,7 @@ var ipCmd = &cobra.Command{
if err != nil {
exit.WithError("Error getting IP", err)
}
console.OutLn(ip)
console.Out(ip)
},
}

Expand Down
Loading

0 comments on commit 79628d3

Please sign in to comment.