This command:
xgettext -LShell -o - input.sh
on this file input.sh:
oddpos gettext "string bar"
evenpos foo gettext "string foo"
produces
#: input.sh:2
msgid "string foo"
msgstr ""
(and nothing else).
That is, keywords are only acted upon if in an even (one-indexed)
position. Is this a bug? Is keyword extraction even supposed to work on
anything except the first part of the command? The source for
gettext-0.19.3 suggests it is according to the comments on read_command()
in gettext-tools/src/x-sh.c, but I appreciate it is something of an edge
case.
The context for this comes from the fact that the a program I am
contributing to has a command that takes a string as an argument like this:
complete -c ls -s l --description "Long"
The string passed as the description argument is translated by the
complete program, rather than requiring shell scripts to call gettext
themselves. The build process uses `xgettext -LShell -k--description` to
extract these messages for translation, but it only works if there are the
right number of other arguments before the keyword `--description`.
I'm not sure whether this is the right use of xgettext, but it got
introduced back in 2007 in our codebase.
David Adam
address@hidden