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

Multilingual Help Commands #5445

Closed
2 tasks done
Pi-Cla opened this issue Apr 7, 2024 · 2 comments
Closed
2 tasks done

Multilingual Help Commands #5445

Pi-Cla opened this issue Apr 7, 2024 · 2 comments
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing

Comments

@Pi-Cla
Copy link
Contributor

Pi-Cla commented Apr 7, 2024

Please complete the following tasks

Clap Version

4.5.4

Describe your use case

What if the user of myapp could access a help page in their own language?

Describe the solution you'd like

For example a user could type in:

myapp -h fr

to get the French version of the help page.

and developers of myapp would only need to add one more argument in order to add the translation like so:

struct Cli {
    #[arg(help = "Does thing", help(fr,"Fait la chose"))]
    thing: bool,
}

Alternatives, if applicable

No response

Additional Context

No response

@Pi-Cla Pi-Cla added the C-enhancement Category: Raise on the bar on expectations label Apr 7, 2024
@ziyouwa
Copy link

ziyouwa commented Apr 9, 2024

All functions automatically created by Clap, hope to be able to customize messages, as blow:
#[clap(next_help_heading = "选项", version_message_zh_CN = "打印版本信息", help_message_zh_CN = "打印帮助信息")]

@epage epage added M-breaking-change Meta: Implementing or merging this will introduce a breaking change. A-help Area: documentation, including docs.rs, readme, examples, etc... S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing labels Apr 9, 2024
@epage
Copy link
Member

epage commented Apr 9, 2024

We have #380 for allowing clap to be localized.

Switching --help to accepting an argument would be a breaking change for applications. We could limit the scope to just applications that want support for more than one translation but that also means adopting translations is a breaking change.

I also generally view command-lines as something for state that can change run to run but I would expect this to be something to change by the user, rather than by the invocation instance, and seems like something that belongs in config.

This also feels like its verging on clap becoming a bespoke localization framework and I'd rather smooth out the path for people to choose what localization framework works for them.

With all of that, I lean towards closing this in favor of #380. If there is a reason we should re-evaluate this, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing
Projects
None yet
Development

No branches or pull requests

3 participants