Mark "help" subcommand and "--help" flag for translation #628
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently:
Note that "help", and the explanation "Help about any command" are not translated.
This is because they don't appear in the Gettext catalogue.
Pending merge of https://github.com/spf13/cobra/pull/2090, it's possible that we can work around this by defining our own
helpCommand
andhelpFlag
– but how to do this without huge repetition is not immediately obvious to me.If you set it once on the
rootCmd
the implementation incobra
will walk back up the command tree to run it 🎉@decentral1se I still don't see "Help about any command" or "help for" in the translation catalogue on
main
, halpFull current output of
abra -h
in case that helps:Oh dear dog, i see 🤦 Digging into this...
Aight, for "Help about any command", it looks like we also need to override the help command itself:
7da941c354/command.go (L337-L340)
7da941c354/command.go (L1269-L1310)
And that seems like quite some copy/pasta but I don't think we can avoid that? Meh.
And to smash the "help for abra", I think we need to set our own help flag and mark it translatable?
7da941c354/command.go (L1216-L1232)
That seems like less code, just defining it ourselves and then it's done.
Yep 💯, I started looking into this last week but quailed at how many places it might need to be copypasta'd and ran away.
Oh shit, while I'm still here, we also need to override that "version for" bit:
7da941c354/command.go (L1234-L1257)
I think it's the same as before, we just need to set it once on the
rootCmd
and it will propagate.Will take a pass at it next hacking run unless someone else gets there first 🤸
#641