feat(translate): add translation for help message - #2944
Merged
Conversation
Allow for the help message to be localized. This changes the help message printing so that every message is wrapped in `gotext.Get()`.
Owner
|
Part of me wishes we had a "cobra like" https://cobra.dev/docs/tutorials/12-factor-app/ cmd for our cli pattern. |
Owner
|
the misaligned flag I leave to your best judgement if you want to change it |
Jguer
approved these changes
Aug 7, 2026
Contributor
Author
Yeah that would be nice, although the it is probably just more hassle at this point to migrate. We probably could mimic pacman's cli using cobra's customization, but at a certain point that'd probably be almost as much work as just maintaining the current cmd.
I added a solution in #2978. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #2921. Allow for the help message to be localized. This changes the help message printing so that every message is wrapped in
gotext.Get().There are a couple things different than the previous help message which I can revert if the old way is preferred.
<xxx>) are no longer aligned with each other. This aligns with pacman's help message and makes the code a tiny bit simpler.pacman -<op> --helpmessage but yay doesn't, I added the messageuse 'yay {-h --help}' for global optionsto operation-specific help messages (maybe addwithout an operation?). This matches the message in the global menu:use 'yay {-h --help}' with an operation for available optionsand I think it is a better option than cluttering every operation-specific message with the global options.I did not run
make localeas that would create thousands of lines of diff, but I think that should be run to update the .po files (I'm not exactly sure how they work). Note that when runningmake locale, it only changesen.poasmv po/default.pot po/en.poshould be acpif I understand correctly.Last, the only misaligned flag is
--completioninterval's arg:If the following is preferred, I can change the description to be a newline when arguments overrun the limit (what pacman does) or just shift all the other descriptions over by 4 characters: