In man-db's apropos program, I use the following doc string:
static const char apropos_doc[] = "\v" N_("The --regex option is enabled by
default.");
The argp documentation says nothing to suggest that I can't leave the
part of argp->doc before \v empty, to provide only extra text to be
printed after the options. However, this breaks because argp_doc ends up
calling dgettext (argp->argp_domain, ""), which gets translated to the
PO file header. The result looks like this:
Usage: apropos [OPTION...] KEYWORD...
Project-Id-Version: man-db
Report-Msgid-Bugs-To: FULL NAME <[EMAIL PROTECTED]>
POT-Creation-Date: 2008-01-27 16:58+0000
PO-Revision-Date: 2007-11-20 13:30+0000
Last-Translator: Jen Ockwell <[EMAIL PROTECTED]>
Language-Team: English (United Kingdom) <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Launchpad-Export-Date: 2008-05-28 11:32+0000
X-Generator: Launchpad (build Unknown)
-d, --debug emit debugging messages
-v, --verbose print verbose warning messages
-e, --exact search each keyword for exact match
-r, --regex interpret each keyword as a regex
-w, --wildcard the keyword(s) contain wildcards
-a, --and require all keywords to match
-l, --long do not trim output to terminal width
-C, --config-file=FILE use this user configuration file
-L, --locale=LOCALE define the locale for this search
-m, --systems=SYSTEM use manual pages from other systems
-M, --manpath=PATH set search path for manual pages to PATH
-s, --section=SECTION search only this section
-?, --help give this help list
--usage give a short usage message
-V, --version print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
The --regex option is enabled by default.
Report bugs to [EMAIL PROTECTED]
The attached patch fixes this.
2008-08-06 Colin Watson <[EMAIL PROTECTED]>
* lib/argp-help.c (argp_doc): Don't translate the empty string.
Thanks,
--
Colin Watson [EMAIL PROTECTED]
diff --git a/lib/argp-help.c b/lib/argp-help.c
index a9843c0..98382a2 100644
--- a/lib/argp-help.c
+++ b/lib/argp-help.c
@@ -1513,7 +1513,10 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
}
else
inp_text = post ? 0 : argp->doc;
- trans_text = inp_text ? dgettext (argp->argp_domain, inp_text) : NULL;
+ if (inp_text)
+ trans_text = *inp_text ? dgettext (argp->argp_domain, inp_text) : "";
+ else
+ trans_text = NULL;
}
else
trans_text = inp_text = 0;