From cc8428566ea7160c5b20410a1bee53ca7ddb998e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20=27NaN=27=20Wikstr=C3=B6m?= Date: Fri, 9 Oct 2020 13:16:13 +0200 Subject: [PATCH] cleanup: use i18n.T on all command descriptions cleanup: use i18n.T only on string literals cleanup: sort imports Add i18n dependency for wait.go Remove translation on envResource cleanup: translate string instead of variable cleanup: sort imports cleanup: translate string literal only --- .../src/k8s.io/kubectl/pkg/cmd/annotate/annotate.go | 4 ++-- .../kubectl/pkg/cmd/apiresources/apiresources.go | 5 +++-- .../k8s.io/kubectl/pkg/cmd/apiresources/apiversions.go | 4 ++-- .../kubectl/pkg/cmd/apply/apply_edit_last_applied.go | 7 ++++--- staging/src/k8s.io/kubectl/pkg/cmd/attach/attach.go | 2 +- .../kubectl/pkg/cmd/certificates/certificates.go | 10 +++++----- staging/src/k8s.io/kubectl/pkg/cmd/config/config.go | 8 ++++---- .../k8s.io/kubectl/pkg/cmd/config/create_authinfo.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/config/create_cluster.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/config/create_context.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/config/current_context.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/config/delete_cluster.go | 2 +- .../k8s.io/kubectl/pkg/cmd/config/delete_context.go | 2 +- .../src/k8s.io/kubectl/pkg/cmd/config/delete_user.go | 2 +- .../src/k8s.io/kubectl/pkg/cmd/config/get_clusters.go | 2 +- .../src/k8s.io/kubectl/pkg/cmd/config/get_contexts.go | 2 +- staging/src/k8s.io/kubectl/pkg/cmd/config/get_users.go | 2 +- .../k8s.io/kubectl/pkg/cmd/config/rename_context.go | 9 +++++---- staging/src/k8s.io/kubectl/pkg/cmd/config/set.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/config/unset.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/config/view.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go | 2 +- .../k8s.io/kubectl/pkg/cmd/create/create_cronjob.go | 5 +++-- .../src/k8s.io/kubectl/pkg/cmd/create/create_secret.go | 2 +- .../k8s.io/kubectl/pkg/cmd/create/create_service.go | 2 +- .../src/k8s.io/kubectl/pkg/cmd/describe/describe.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/exec/exec.go | 2 +- staging/src/k8s.io/kubectl/pkg/cmd/explain/explain.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/expose/expose.go | 6 +++--- staging/src/k8s.io/kubectl/pkg/cmd/get/get.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go | 2 +- staging/src/k8s.io/kubectl/pkg/cmd/options/options.go | 2 +- staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go | 10 +++++----- staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/rollout/rollout_pause.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/rollout/rollout_restart.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/rollout/rollout_resume.go | 4 ++-- .../k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go | 4 ++-- .../src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/set/set.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/set/set_env.go | 7 ++++--- staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go | 8 ++++---- .../src/k8s.io/kubectl/pkg/cmd/set/set_resources.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/set/set_selector.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/set/set_subject.go | 4 ++-- staging/src/k8s.io/kubectl/pkg/cmd/version/version.go | 2 +- staging/src/k8s.io/kubectl/pkg/cmd/wait/BUILD | 1 + staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go | 7 ++++--- 49 files changed, 105 insertions(+), 98 deletions(-) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/annotate/annotate.go b/staging/src/k8s.io/kubectl/pkg/cmd/annotate/annotate.go index c0900c97a39..d7a15df82bc 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/annotate/annotate.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/annotate/annotate.go @@ -78,7 +78,7 @@ type AnnotateOptions struct { } var ( - annotateLong = templates.LongDesc(` + annotateLong = templates.LongDesc(i18n.T(` Update the annotations on one or more resources All Kubernetes objects support the ability to store additional data with the object as @@ -88,7 +88,7 @@ var ( Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on - the server the command will fail.`) + the server the command will fail.`)) annotateExample = templates.Examples(i18n.T(` # Update pod 'foo' with the annotation 'description' and the value 'my frontend'. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiresources.go b/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiresources.go index a8d9620d419..b1177a119e0 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiresources.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiresources.go @@ -31,6 +31,7 @@ import ( "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/printers" cmdutil "k8s.io/kubectl/pkg/cmd/util" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) @@ -90,8 +91,8 @@ func NewCmdAPIResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams cmd := &cobra.Command{ Use: "api-resources", - Short: "Print the supported API resources on the server", - Long: "Print the supported API resources on the server", + Short: i18n.T("Print the supported API resources on the server"), + Long: i18n.T("Print the supported API resources on the server"), Example: apiresourcesExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(cmd, args)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiversions.go b/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiversions.go index 413550cda57..0a506183938 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiversions.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/apiresources/apiversions.go @@ -55,8 +55,8 @@ func NewCmdAPIVersions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) o := NewAPIVersionsOptions(ioStreams) cmd := &cobra.Command{ Use: "api-versions", - Short: "Print the supported API versions on the server, in the form of \"group/version\"", - Long: "Print the supported API versions on the server, in the form of \"group/version\"", + Short: i18n.T("Print the supported API versions on the server, in the form of \"group/version\""), + Long: i18n.T("Print the supported API versions on the server, in the form of \"group/version\""), Example: apiversionsExample, DisableFlagsInUseLine: true, Run: func(cmd *cobra.Command, args []string) { diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/apply/apply_edit_last_applied.go b/staging/src/k8s.io/kubectl/pkg/cmd/apply/apply_edit_last_applied.go index 37e54c1af0b..2d0187b17bd 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/apply/apply_edit_last_applied.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/apply/apply_edit_last_applied.go @@ -22,11 +22,12 @@ import ( "k8s.io/cli-runtime/pkg/genericclioptions" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/cmd/util/editor" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) var ( - applyEditLastAppliedLong = templates.LongDesc(` + applyEditLastAppliedLong = templates.LongDesc(i18n.T(` Edit the latest last-applied-configuration annotations of resources from the default editor. The edit-last-applied command allows you to directly edit any API resource you can retrieve via the @@ -45,7 +46,7 @@ var ( that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary - saved copy to include the latest resource version.`) + saved copy to include the latest resource version.`)) applyEditLastAppliedExample = templates.Examples(` # Edit the last-applied-configuration annotations by type/name in YAML. @@ -62,7 +63,7 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, ioStreams genericclioptions.I cmd := &cobra.Command{ Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)", DisableFlagsInUseLine: true, - Short: "Edit latest last-applied-configuration annotations of a resource/object", + Short: i18n.T("Edit latest last-applied-configuration annotations of a resource/object"), Long: applyEditLastAppliedLong, Example: applyEditLastAppliedExample, Run: func(cmd *cobra.Command, args []string) { diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/attach/attach.go b/staging/src/k8s.io/kubectl/pkg/cmd/attach/attach.go index e8489eb2043..ba63cae65f5 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/attach/attach.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/attach/attach.go @@ -103,7 +103,7 @@ func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra Use: "attach (POD | TYPE/NAME) -c CONTAINER", DisableFlagsInUseLine: true, Short: i18n.T("Attach to a running container"), - Long: "Attach to a process that is already running inside an existing container.", + Long: i18n.T("Attach to a process that is already running inside an existing container."), Example: attachExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd, args)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go b/staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go index 570f142756f..08fc609818f 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go @@ -46,7 +46,7 @@ func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) Use: "certificate SUBCOMMAND", DisableFlagsInUseLine: true, Short: i18n.T("Modify certificate resources."), - Long: "Modify certificate resources.", + Long: i18n.T("Modify certificate resources."), Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, @@ -118,7 +118,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS Use: "approve (-f FILENAME | NAME)", DisableFlagsInUseLine: true, Short: i18n.T("Approve a certificate signing request"), - Long: templates.LongDesc(` + Long: templates.LongDesc(i18n.T(` Approve a certificate signing request. kubectl certificate approve allows a cluster admin to approve a certificate @@ -129,7 +129,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS can potentially grant a requester access to cluster resources or to authenticate as a requested identity. Before approving a CSR, ensure you understand what the signed certificate can do. - `), + `)), Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Validate()) @@ -161,13 +161,13 @@ func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStre Use: "deny (-f FILENAME | NAME)", DisableFlagsInUseLine: true, Short: i18n.T("Deny a certificate signing request"), - Long: templates.LongDesc(` + Long: templates.LongDesc(i18n.T(` Deny a certificate signing request. kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor. - `), + `)), Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd, args)) cmdutil.CheckErr(o.Validate()) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/config.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/config.go index 7848c396145..74a0e217515 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/config.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/config.go @@ -40,14 +40,14 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, streams Use: "config SUBCOMMAND", DisableFlagsInUseLine: true, Short: i18n.T("Modify kubeconfig files"), - Long: templates.LongDesc(` + Long: templates.LongDesc(i18n.T(` Modify kubeconfig files using subcommands like "kubectl config set current-context my-context" The loading order follows these rules: - 1. If the --` + pathOptions.ExplicitFileFlag + ` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place. - 2. If $` + pathOptions.EnvVar + ` environment variable is set, then it is used as a list of paths (normal path delimiting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. - 3. Otherwise, ` + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + ` is used and no merging takes place.`), + 1. If the --`) + pathOptions.ExplicitFileFlag + i18n.T(` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place. + 2. If $`) + pathOptions.EnvVar + i18n.T(` environment variable is set, then it is used as a list of paths (normal path delimiting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. + 3. Otherwise, `) + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + i18n.T(` is used and no merging takes place.`)), Run: cmdutil.DefaultSubCommandRun(streams.ErrOut), } diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_authinfo.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_authinfo.go index 3d80e992766..bf4ec20be7c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_authinfo.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_authinfo.go @@ -67,7 +67,7 @@ const ( ) var ( - createAuthInfoLong = fmt.Sprintf(templates.LongDesc(` + createAuthInfoLong = fmt.Sprintf(templates.LongDesc(i18n.T(` Sets a user entry in kubeconfig Specifying a name that already exists will merge new fields on top of existing values. @@ -81,7 +81,7 @@ var ( Basic auth flags: --%v=basic_user --%v=basic_password - Bearer token and basic auth are mutually exclusive.`), clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword) + Bearer token and basic auth are mutually exclusive.`)), clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword) createAuthInfoExample = templates.Examples(` # Set only the "client-key" field on the "cluster-admin" diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_cluster.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_cluster.go index e49372104a0..6ca07cf24c6 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_cluster.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_cluster.go @@ -44,10 +44,10 @@ type createClusterOptions struct { } var ( - createClusterLong = templates.LongDesc(` + createClusterLong = templates.LongDesc(i18n.T(` Sets a cluster entry in kubeconfig. - Specifying a name that already exists will merge new fields on top of existing values for those fields.`) + Specifying a name that already exists will merge new fields on top of existing values for those fields.`)) createClusterExample = templates.Examples(` # Set only the server field on the e2e cluster entry without touching other values. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_context.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_context.go index e27e108eb76..2b1d849a47e 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/create_context.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/create_context.go @@ -41,10 +41,10 @@ type createContextOptions struct { } var ( - createContextLong = templates.LongDesc(` + createContextLong = templates.LongDesc(i18n.T(` Sets a context entry in kubeconfig - Specifying a name that already exists will merge new fields on top of existing values for those fields.`) + Specifying a name that already exists will merge new fields on top of existing values for those fields.`)) createContextExample = templates.Examples(` # Set the user field on the gce context entry without touching other values diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/current_context.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/current_context.go index cea2f646185..aa65d44658c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/current_context.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/current_context.go @@ -34,8 +34,8 @@ type CurrentContextOptions struct { } var ( - currentContextLong = templates.LongDesc(` - Displays the current-context`) + currentContextLong = templates.LongDesc(i18n.T(` + Displays the current-context`)) currentContextExample = templates.Examples(` # Display the current-context diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go index a34686da26c..318629cf10c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go @@ -39,7 +39,7 @@ func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAcces Use: "delete-cluster NAME", DisableFlagsInUseLine: true, Short: i18n.T("Delete the specified cluster from the kubeconfig"), - Long: "Delete the specified cluster from the kubeconfig", + Long: i18n.T("Delete the specified cluster from the kubeconfig"), Example: deleteClusterExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(runDeleteCluster(out, configAccess, cmd)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_context.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_context.go index f019e159d51..8221bba873d 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_context.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_context.go @@ -39,7 +39,7 @@ func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.Con Use: "delete-context NAME", DisableFlagsInUseLine: true, Short: i18n.T("Delete the specified context from the kubeconfig"), - Long: "Delete the specified context from the kubeconfig", + Long: i18n.T("Delete the specified context from the kubeconfig"), Example: deleteContextExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(runDeleteContext(out, errOut, configAccess, cmd)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_user.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_user.go index 66f709bcab9..a2da971382b 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_user.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_user.go @@ -62,7 +62,7 @@ func NewCmdConfigDeleteUser(streams genericclioptions.IOStreams, configAccess cl Use: "delete-user NAME", DisableFlagsInUseLine: true, Short: i18n.T("Delete the specified user from the kubeconfig"), - Long: "Delete the specified user from the kubeconfig", + Long: i18n.T("Delete the specified user from the kubeconfig"), Example: deleteUserExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(cmd, args)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_clusters.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_clusters.go index 5c3fd2e1c26..5c048d75e5f 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_clusters.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_clusters.go @@ -39,7 +39,7 @@ func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess) cmd := &cobra.Command{ Use: "get-clusters", Short: i18n.T("Display clusters defined in the kubeconfig"), - Long: "Display clusters defined in the kubeconfig.", + Long: i18n.T("Display clusters defined in the kubeconfig."), Example: getClustersExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(runGetClusters(out, configAccess)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_contexts.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_contexts.go index a9016a4e740..d2f7a987fac 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_contexts.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_contexts.go @@ -47,7 +47,7 @@ type GetContextsOptions struct { } var ( - getContextsLong = templates.LongDesc(`Displays one or many contexts from the kubeconfig file.`) + getContextsLong = templates.LongDesc(i18n.T(`Displays one or many contexts from the kubeconfig file.`)) getContextsExample = templates.Examples(` # List all the contexts in your kubeconfig file diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_users.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_users.go index 6feb4abfb84..926df7c467c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/get_users.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/get_users.go @@ -58,7 +58,7 @@ func NewCmdConfigGetUsers(streams genericclioptions.IOStreams, configAccess clie cmd := &cobra.Command{ Use: "get-users", Short: i18n.T("Display users defined in the kubeconfig"), - Long: "Display users defined in the kubeconfig.", + Long: i18n.T("Display users defined in the kubeconfig."), Example: getUsersExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Run()) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/rename_context.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/rename_context.go index 8a64a3469f9..3a8022538e4 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/rename_context.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/rename_context.go @@ -25,6 +25,7 @@ import ( "k8s.io/client-go/tools/clientcmd" cmdutil "k8s.io/kubectl/pkg/cmd/util" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) @@ -37,19 +38,19 @@ type RenameContextOptions struct { const ( renameContextUse = "rename-context CONTEXT_NAME NEW_NAME" - - renameContextShort = "Renames a context from the kubeconfig file." ) var ( - renameContextLong = templates.LongDesc(` + renameContextShort = i18n.T("Renames a context from the kubeconfig file.") + + renameContextLong = templates.LongDesc(i18n.T(` Renames a context from the kubeconfig file. CONTEXT_NAME is the context name that you wish to change. NEW_NAME is the new name you wish to set. - Note: In case the context being renamed is the 'current-context', this field will also be updated.`) + Note: In case the context being renamed is the 'current-context', this field will also be updated.`)) renameContextExample = templates.Examples(` # Rename the context 'old-name' to 'new-name' in your kubeconfig file diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/set.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/set.go index 9e9fcd86954..a9237e98040 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/set.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/set.go @@ -41,14 +41,14 @@ type setOptions struct { } var ( - setLong = templates.LongDesc(` + setLong = templates.LongDesc(i18n.T(` Sets an individual value in a kubeconfig file PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots. PROPERTY_VALUE is the new value you wish to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used. - Specifying a attribute name that already exists will merge new fields on top of existing values.`) + Specifying a attribute name that already exists will merge new fields on top of existing values.`)) setExample = templates.Examples(` # Set server field on the my-cluster cluster to https://1.2.3.4 diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/unset.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/unset.go index 6af73d1c41d..a438452936c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/unset.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/unset.go @@ -36,10 +36,10 @@ type unsetOptions struct { } var ( - unsetLong = templates.LongDesc(` + unsetLong = templates.LongDesc(i18n.T(` Unsets an individual value in a kubeconfig file - PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.`) + PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.`)) unsetExample = templates.Examples(` # Unset the current-context. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/config/view.go b/staging/src/k8s.io/kubectl/pkg/cmd/config/view.go index 356eac55d9d..1f071a25980 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/config/view.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/config/view.go @@ -51,10 +51,10 @@ type ViewOptions struct { } var ( - viewLong = templates.LongDesc(` + viewLong = templates.LongDesc(i18n.T(` Display merged kubeconfig settings or a specified kubeconfig file. - You can use --output jsonpath={...} to extract specific values using a jsonpath expression.`) + You can use --output jsonpath={...} to extract specific values using a jsonpath expression.`)) viewExample = templates.Examples(` # Show merged kubeconfig settings. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go b/staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go index 47737f4731e..605f36dda36 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/cp/cp.go @@ -102,7 +102,7 @@ func NewCmdCp(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.C Use: "cp ", DisableFlagsInUseLine: true, Short: i18n.T("Copy files and directories to and from containers."), - Long: "Copy files and directories to and from containers.", + Long: i18n.T("Copy files and directories to and from containers."), Example: cpExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_cronjob.go b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_cronjob.go index 57709febb26..758ae0db480 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_cronjob.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_cronjob.go @@ -33,12 +33,13 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/scheme" "k8s.io/kubectl/pkg/util" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) var ( - cronjobLong = templates.LongDesc(` - Create a cronjob with the specified name.`) + cronjobLong = templates.LongDesc(i18n.T(` + Create a cronjob with the specified name.`)) cronjobExample = templates.Examples(` # Create a cronjob diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_secret.go b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_secret.go index 1879b8e9c7a..f9499e54834 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_secret.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_secret.go @@ -32,7 +32,7 @@ func NewCmdCreateSecret(f cmdutil.Factory, ioStreams genericclioptions.IOStreams cmd := &cobra.Command{ Use: "secret", Short: i18n.T("Create a secret using specified subcommand"), - Long: "Create a secret using specified subcommand.", + Long: i18n.T("Create a secret using specified subcommand."), Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut), } cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, ioStreams)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_service.go b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_service.go index 9111d1003be..4cede960557 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/create/create_service.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/create/create_service.go @@ -34,7 +34,7 @@ func NewCmdCreateService(f cmdutil.Factory, ioStreams genericclioptions.IOStream Use: "service", Aliases: []string{"svc"}, Short: i18n.T("Create a service using specified subcommand."), - Long: "Create a service using specified subcommand.", + Long: i18n.T("Create a service using specified subcommand."), Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut), } cmd.AddCommand(NewCmdCreateServiceClusterIP(f, ioStreams)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/describe/describe.go b/staging/src/k8s.io/kubectl/pkg/cmd/describe/describe.go index bfc794978d3..a58b432f541 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/describe/describe.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/describe/describe.go @@ -35,7 +35,7 @@ import ( ) var ( - describeLong = templates.LongDesc(` + describeLong = templates.LongDesc(i18n.T(` Show details of a specific resource or group of resources Print a detailed description of the selected resources, including related resources such @@ -45,7 +45,7 @@ var ( $ kubectl describe TYPE NAME_PREFIX will first check for an exact match on TYPE and NAME_PREFIX. If no such resource - exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.`) + exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.`)) describeExample = templates.Examples(i18n.T(` # Describe a node diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/exec/exec.go b/staging/src/k8s.io/kubectl/pkg/cmd/exec/exec.go index f55296c848e..bbca1ea2d76 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/exec/exec.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/exec/exec.go @@ -85,7 +85,7 @@ func NewCmdExec(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C Use: "exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]", DisableFlagsInUseLine: true, Short: i18n.T("Execute a command in a container"), - Long: "Execute a command in a container.", + Long: i18n.T("Execute a command in a container."), Example: execExample, Run: func(cmd *cobra.Command, args []string) { argsLenAtDash := cmd.ArgsLenAtDash() diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/explain/explain.go b/staging/src/k8s.io/kubectl/pkg/cmd/explain/explain.go index 78dd7fd7fd1..982081f05bb 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/explain/explain.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/explain/explain.go @@ -32,7 +32,7 @@ import ( ) var ( - explainLong = templates.LongDesc(` + explainLong = templates.LongDesc(i18n.T(` List the fields for supported resources This command describes the fields associated with each supported API resource. @@ -41,7 +41,7 @@ var ( .[.] Add the --recursive flag to display all of the fields at once without descriptions. - Information about each field is retrieved from the server in OpenAPI format.`) + Information about each field is retrieved from the server in OpenAPI format.`)) explainExamples = templates.Examples(i18n.T(` # Get the documentation of the resource and its fields diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/expose/expose.go b/staging/src/k8s.io/kubectl/pkg/cmd/expose/expose.go index eae9cdcccd1..47c97ecb359 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/expose/expose.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/expose/expose.go @@ -42,9 +42,9 @@ import ( ) var ( - exposeResources = `pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)` + exposeResources = i18n.T(`pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)`) - exposeLong = templates.LongDesc(` + exposeLong = templates.LongDesc(i18n.T(` Expose a resource as a new Kubernetes service. Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector @@ -56,7 +56,7 @@ var ( Possible resources include (case insensitive): - ` + exposeResources) + `) + exposeResources) exposeExample = templates.Examples(i18n.T(` # Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go b/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go index 5c5999f4f70..d83fbd37cf1 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go @@ -85,7 +85,7 @@ type GetOptions struct { } var ( - getLong = templates.LongDesc(` + getLong = templates.LongDesc(i18n.T(` Display one or many resources Prints a table of the most important information about the specified resources. @@ -96,7 +96,7 @@ var ( Uninitialized objects are not shown unless --include-uninitialized is passed. By specifying the output as 'template' and providing a Go template as the value - of the --template flag, you can filter the attributes of the fetched resources.`) + of the --template flag, you can filter the attributes of the fetched resources.`)) getExample = templates.Examples(i18n.T(` # List all pods in ps output format. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go b/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go index 3953a396a7c..6caeff99d80 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go @@ -146,7 +146,7 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C Use: logsUsageStr, DisableFlagsInUseLine: true, Short: i18n.T("Print the logs for a container in a pod"), - Long: "Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", + Long: i18n.T("Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional."), Example: logsExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd, args)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/options/options.go b/staging/src/k8s.io/kubectl/pkg/cmd/options/options.go index a4e22d0970a..cad4453e2cb 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/options/options.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/options/options.go @@ -36,7 +36,7 @@ func NewCmdOptions(out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "options", Short: i18n.T("Print the list of flags inherited by all commands"), - Long: "Print the list of flags inherited by all commands", + Long: i18n.T("Print the list of flags inherited by all commands"), Example: optionsExample, Run: func(cmd *cobra.Command, args []string) { cmd.Usage() diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go b/staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go index ba56612e27f..22af63c1885 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go @@ -34,23 +34,23 @@ import ( ) var ( - pluginLong = templates.LongDesc(` + pluginLong = templates.LongDesc(i18n.T(` Provides utilities for interacting with plugins. Plugins provide extended functionality that is not part of the major command-line distribution. Please refer to the documentation and examples for more information about how write your own plugins. The easiest way to discover and install plugins is via the kubernetes sub-project krew. - To install krew, visit [krew.sigs.k8s.io](https://krew.sigs.k8s.io/docs/user-guide/setup/install/)`) + To install krew, visit [krew.sigs.k8s.io](https://krew.sigs.k8s.io/docs/user-guide/setup/install/)`)) - pluginListLong = templates.LongDesc(` + pluginListLong = templates.LongDesc(i18n.T(` List all available plugin files on a user's PATH. Available plugin files are those that are: - executable - anywhere on the user's PATH - begin with "kubectl-" -`) +`)) ValidPluginFilenamePrefixes = []string{"kubectl"} ) @@ -87,7 +87,7 @@ func NewCmdPluginList(f cmdutil.Factory, streams genericclioptions.IOStreams) *c cmd := &cobra.Command{ Use: "list", - Short: "list all visible plugin executables on a user's PATH", + Short: i18n.T("list all visible plugin executables on a user's PATH"), Long: pluginListLong, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(cmd)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout.go index a9a80a5be2e..3e27342bddd 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout.go @@ -27,8 +27,8 @@ import ( ) var ( - rolloutLong = templates.LongDesc(` - Manage the rollout of a resource.` + rolloutValidResources) + rolloutLong = templates.LongDesc(i18n.T(` + Manage the rollout of a resource.`) + rolloutValidResources) rolloutExample = templates.Examples(` # Rollback to the previous deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go index d82c94fbf87..9cf3639218d 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_history.go @@ -32,8 +32,8 @@ import ( ) var ( - historyLong = templates.LongDesc(` - View previous rollout revisions and configurations.`) + historyLong = templates.LongDesc(i18n.T(` + View previous rollout revisions and configurations.`)) historyExample = templates.Examples(` # View the rollout history of a deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_pause.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_pause.go index 49afa891af3..2470c004927 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_pause.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_pause.go @@ -53,12 +53,12 @@ type PauseOptions struct { } var ( - pauseLong = templates.LongDesc(` + pauseLong = templates.LongDesc(i18n.T(` Mark the provided resource as paused Paused resources will not be reconciled by a controller. Use "kubectl rollout resume" to resume a paused resource. - Currently only deployments support being paused.`) + Currently only deployments support being paused.`)) pauseExample = templates.Examples(` # Mark the nginx deployment as paused. Any current state of diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_restart.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_restart.go index 4492b56af30..0a980cf8f5d 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_restart.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_restart.go @@ -53,10 +53,10 @@ type RestartOptions struct { } var ( - restartLong = templates.LongDesc(` + restartLong = templates.LongDesc(i18n.T(` Restart a resource. - Resource will be rollout restarted.`) + Resource will be rollout restarted.`)) restartExample = templates.Examples(` # Restart a deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_resume.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_resume.go index 524983cef46..915c779e565 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_resume.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_resume.go @@ -54,12 +54,12 @@ type ResumeOptions struct { } var ( - resumeLong = templates.LongDesc(` + resumeLong = templates.LongDesc(i18n.T(` Resume a paused resource Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. - Currently only deployments support being resumed.`) + Currently only deployments support being resumed.`)) resumeExample = templates.Examples(` # Resume an already paused deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go index 6f29e146343..4abee4ba084 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go @@ -43,7 +43,7 @@ import ( ) var ( - statusLong = templates.LongDesc(` + statusLong = templates.LongDesc(i18n.T(` Show the status of the rollout. By default 'rollout status' will watch the status of the latest rollout @@ -51,7 +51,7 @@ var ( you can use --watch=false. Note that if a new rollout starts in-between, then 'rollout status' will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, - use --revision=N where N is the revision you need to watch for.`) + use --revision=N where N is the revision you need to watch for.`)) statusExample = templates.Examples(` # Watch the rollout status of a deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go index 779d1b96682..e2e31955678 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_undo.go @@ -51,8 +51,8 @@ type UndoOptions struct { } var ( - undoLong = templates.LongDesc(` - Rollback to a previous rollout.`) + undoLong = templates.LongDesc(i18n.T(` + Rollback to a previous rollout.`)) undoExample = templates.Examples(` # Rollback to the previous deployment diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set.go index 127dcb247a5..54b7aed12b9 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set.go @@ -25,10 +25,10 @@ import ( ) var ( - setLong = templates.LongDesc(` + setLong = templates.LongDesc(i18n.T(` Configure application resources - These commands help you make changes to existing application resources.`) + These commands help you make changes to existing application resources.`)) ) // NewCmdSet returns an initialized Command instance for 'set' sub command diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_env.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_env.go index 009ee746869..ebd54e4f71d 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_env.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_env.go @@ -38,6 +38,7 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/polymorphichelpers" "k8s.io/kubectl/pkg/scheme" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) @@ -46,7 +47,7 @@ var ( envResources = ` pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)` - envLong = templates.LongDesc(` + envLong = templates.LongDesc(i18n.T(` Update environment variables on a pod template. List environment variable definitions in one or more pods, pod templates. @@ -59,7 +60,7 @@ var ( syntax. Possible resources include (case insensitive): - ` + envResources) + `) + envResources) envExample = templates.Examples(` # Update deployment 'registry' with a new environment variable @@ -150,7 +151,7 @@ func NewCmdEnv(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Co cmd := &cobra.Command{ Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N", DisableFlagsInUseLine: true, - Short: "Update environment variables on a pod template", + Short: i18n.T("Update environment variables on a pod template"), Long: envLong, Example: envExample, Run: func(cmd *cobra.Command, args []string) { diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go index 37bb84a61a6..63279068203 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go @@ -65,14 +65,14 @@ type SetImageOptions struct { } var ( - imageResources = ` - pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)` + imageResources = i18n.T(` + pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)`) - imageLong = templates.LongDesc(` + imageLong = templates.LongDesc(i18n.T(` Update existing container image(s) of resources. Possible resources include (case insensitive): - ` + imageResources) + `) + imageResources) imageExample = templates.Examples(` # Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_resources.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_resources.go index 8d62d4f1a68..eb8f858df86 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_resources.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_resources.go @@ -38,12 +38,12 @@ import ( ) var ( - resourcesLong = templates.LongDesc(` + resourcesLong = templates.LongDesc(i18n.T(` Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits. for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit. - Possible resources include (case insensitive): %s.`) + Possible resources include (case insensitive): %s.`)) resourcesExample = templates.Examples(` # Set a deployments nginx container cpu limits to "200m" and memory to "512Mi" diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_selector.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_selector.go index 34ae603b556..913ab76b11b 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_selector.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_selector.go @@ -64,13 +64,13 @@ type SetSelectorOptions struct { } var ( - selectorLong = templates.LongDesc(` + selectorLong = templates.LongDesc(i18n.T(` Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'. A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to %[1]d characters. If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. - Note: currently selectors can only be set on Service objects.`) + Note: currently selectors can only be set on Service objects.`)) selectorExample = templates.Examples(` # set the labels and selector before creating a deployment/service pair. kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f - diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_subject.go b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_subject.go index 043fd5e4010..4b989fa4ff6 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/set/set_subject.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/set/set_subject.go @@ -37,8 +37,8 @@ import ( ) var ( - subjectLong = templates.LongDesc(` - Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`) + subjectLong = templates.LongDesc(i18n.T(` + Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`)) subjectExample = templates.Examples(` # Update a ClusterRoleBinding for serviceaccount1 diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/version/version.go b/staging/src/k8s.io/kubectl/pkg/cmd/version/version.go index 0149d1bbf38..7c7cf26a04d 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/version/version.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/version/version.go @@ -71,7 +71,7 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co cmd := &cobra.Command{ Use: "version", Short: i18n.T("Print the client and server version information"), - Long: "Print the client and server version information for the current context", + Long: i18n.T("Print the client and server version information for the current context"), Example: versionExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete(f, cmd)) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/wait/BUILD b/staging/src/k8s.io/kubectl/pkg/cmd/wait/BUILD index b578bef26fa..1806f77d2c8 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/wait/BUILD +++ b/staging/src/k8s.io/kubectl/pkg/cmd/wait/BUILD @@ -22,6 +22,7 @@ go_library( "//staging/src/k8s.io/client-go/dynamic:go_default_library", "//staging/src/k8s.io/client-go/tools/watch:go_default_library", "//staging/src/k8s.io/kubectl/pkg/cmd/util:go_default_library", + "//staging/src/k8s.io/kubectl/pkg/util/i18n:go_default_library", "//staging/src/k8s.io/kubectl/pkg/util/templates:go_default_library", "//vendor/github.com/spf13/cobra:go_default_library", ], diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go b/staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go index 6cd4710ca1d..d781a76f7f5 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go @@ -41,11 +41,12 @@ import ( "k8s.io/client-go/dynamic" watchtools "k8s.io/client-go/tools/watch" cmdutil "k8s.io/kubectl/pkg/cmd/util" + "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) var ( - waitLong = templates.LongDesc(` + waitLong = templates.LongDesc(i18n.T(` Experimental: Wait for a specific condition on one or many resources. The command takes multiple resources and waits until the specified condition @@ -55,7 +56,7 @@ var ( by providing the "delete" keyword as the value to the --for flag. A successful message will be printed to stdout indicating when the specified - condition has been met. One can use -o option to change to output destination.`) + condition has been met. One can use -o option to change to output destination.`)) waitExample = templates.Examples(` # Wait for the pod "busybox1" to contain the status condition of type "Ready". @@ -108,7 +109,7 @@ func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams gen cmd := &cobra.Command{ Use: "wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available]", - Short: "Experimental: Wait for a specific condition on one or many resources.", + Short: i18n.T("Experimental: Wait for a specific condition on one or many resources."), Long: waitLong, Example: waitExample,