diff options
author | Bruno Haible <bruno@clisp.org> | 2003-02-24 10:54:10 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:10:14 +0200 |
commit | 069c4216f67b5b14c50724d340c4e65b9a559cb3 (patch) | |
tree | 3bcf781d3c67220d366b41e9550620e4ec8a45f1 /gettext-tools/src/msgfmt.c | |
parent | 1ef59bdf5b24ef74a81e61f4e7f3b82f88dd433b (diff) | |
download | external_gettext-069c4216f67b5b14c50724d340c4e65b9a559cb3.zip external_gettext-069c4216f67b5b14c50724d340c4e65b9a559cb3.tar.gz external_gettext-069c4216f67b5b14c50724d340c4e65b9a559cb3.tar.bz2 |
Better error message when an msgstr string is an invalid format string.
Diffstat (limited to 'gettext-tools/src/msgfmt.c')
-rw-r--r-- | gettext-tools/src/msgfmt.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 9e6a4cd..c43a68a 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -1120,8 +1120,10 @@ check_pair (const char *msgid, arguments that are used by other translations. */ struct formatstring_parser *parser = formatstring_parsers[i]; + char *invalid_reason = NULL; void *msgid_descr = - parser->parse (msgid_plural != NULL ? msgid_plural : msgid); + parser->parse (msgid_plural != NULL ? msgid_plural : msgid, + &invalid_reason); if (msgid_descr != NULL) { @@ -1140,7 +1142,7 @@ check_pair (const char *msgid, pretty_msgstr = buf; } - msgstr_descr = parser->parse (p); + msgstr_descr = parser->parse (p, &invalid_reason); if (msgstr_descr != NULL) { @@ -1157,15 +1159,19 @@ check_pair (const char *msgid, error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number, _("\ -'%s' is not a valid %s format string, unlike 'msgid'"), - pretty_msgstr, format_language_pretty[i]); +'%s' is not a valid %s format string, unlike 'msgid'. Reason: %s"), + pretty_msgstr, format_language_pretty[i], + invalid_reason); error_with_progname = true; exit_status = EXIT_FAILURE; + free (invalid_reason); } } parser->free (msgid_descr); } + else + free (invalid_reason); } if (check_accelerators && msgid_plural == NULL) |