Problem with the Spanish translation of the help flag #918

Open
opened 2026-09-01 15:09:48 +00:00 by ChasquiLabo · 0 comments

I found a problem with the Spanish translation of the help flag.

The issue was in cli/run.go, where the flag name and shorthand were being passed through i18n.G():

i18n.G("help"),
i18n.G("h"),

In Spanish, help becomes ayuda, so Abra was creating:

-h, --ayuda

Cobra automatically creates its own -h, --help flag for commands. This caused a conflict:

panic: unable to redefine 'h' shorthand...
it's already used for 'ayuda' flag

I fixed it by keeping the flag identifiers untranslated:

"help",
"h",

while keeping the description translatable:

i18n.G("help for abra")

After this change, LANG=es_ES abradev app --help works correctly again.

It seems this issue only affects help because Cobra handles it as a special built-in flag.

I think it is no problem to keep "help" as the word for "ayuda" in spanish, also is explained at the manual

I found a problem with the Spanish translation of the `help` flag. The issue was in `cli/run.go`, where the flag name and shorthand were being passed through `i18n.G()`: ```go i18n.G("help"), i18n.G("h"), ``` In Spanish, `help` becomes `ayuda`, so Abra was creating: ```text -h, --ayuda ``` Cobra automatically creates its own `-h, --help` flag for commands. This caused a conflict: ```text panic: unable to redefine 'h' shorthand... it's already used for 'ayuda' flag ``` I fixed it by keeping the flag identifiers untranslated: ```go "help", "h", ``` while keeping the description translatable: ```go i18n.G("help for abra") ``` After this change, `LANG=es_ES abradev app --help` works correctly again. It seems this issue only affects `help` because Cobra handles it as a special built-in flag. I think it is no problem to keep "help" as the word for "ayuda" in spanish, also is explained at the manual
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/abra#918