The Wayback Machine - https://web.archive.org/web/20211227054902/https://github.com/spf13/cobra/issues/1134
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-language support for CLIs? #1134

Open
thomasgloe opened this issue Jun 11, 2020 · 7 comments
Open

Multi-language support for CLIs? #1134

thomasgloe opened this issue Jun 11, 2020 · 7 comments

Comments

@thomasgloe
Copy link

@thomasgloe thomasgloe commented Jun 11, 2020

I would like to support multiple languages for my CLI using cobra. Implementation for commands is no problem, but is it correct that there is currently no support for the text output generated by cobra itself (e.g., "Usage", "Flags", "Use "mycmd [command] --help" for more information about a command.")?

@BunnyBrewery
Copy link

@BunnyBrewery BunnyBrewery commented Jun 20, 2020

Are you talking about if there is multi-language support for default help message in Cobra?

@thomasgloe
Copy link
Author

@thomasgloe thomasgloe commented Jun 22, 2020

Yes and I've already checked the source code, where strings are encapsulated in the UsageTemplate. The way to go seems to change the usage template with SetUsageTemplate.

If I have enough time, would it be of interest to include a small example in the docs?

@github-actions
Copy link

@github-actions github-actions bot commented Aug 22, 2020

This issue is being marked as stale due to a long period of inactivity

@jharshman jharshman self-assigned this Sep 24, 2020
@jharshman
Copy link
Collaborator

@jharshman jharshman commented Sep 24, 2020

@thomasgloe I'd be interested to see a PR for this if you wanted to take a shot at it.

@github-actions
Copy link

@github-actions github-actions bot commented Nov 24, 2020

This issue is being marked as stale due to a long period of inactivity

@github-actions
Copy link

@github-actions github-actions bot commented Feb 17, 2021

This issue is being marked as stale due to a long period of inactivity

@hitzhangjie
Copy link

@hitzhangjie hitzhangjie commented Jul 14, 2021

SetsageTemplate may only affects the template. If we want to support multiple languages, we may consider the description of commands and flags.

I use go-i18n to support multiple languages in my cobra cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment