diff options
25 files changed, 206 insertions, 140 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 6a8f7ff..22b8b4a 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,34 @@ +2009-05-29 Bruno Haible <bruno@clisp.org> + + Improve msgfmt error message about format directive mismatches + in msgstr[i]. + * format.h (struct formatstring_parser): Add pretty_msgid argument to + 'check' member. + * format-awk.c (format_check): Add pretty_msgid argument. + * format-boost.c (format_check): Likewise. + * format-c.c (format_check): Likewise. + * format-csharp.c (format_check): Likewise. + * format-elisp.c (format_check): Likewise. + * format-gcc-internal.c (format_check): Likewise. + * format-gfc-internal.c (format_check): Likewise. + * format-java.c (format_check): Likewise. + * format-kde.c (format_check): Likewise. + * format-librep.c (format_check): Likewise. + * format-lisp.c (format_check): Likewise. + * format-pascal.c (format_check): Likewise. + * format-perl-brace.c (format_check): Likewise. + * format-perl.c (format_check): Likewise. + * format-php.c (format_check): Likewise. + * format-python.c (format_check): Likewise. + * format-qt.c (format_check): Likewise. + * format-qt-plural.c (format_check): Likewise. + * format-scheme.c (format_check): Likewise. + * format-sh.c (format_check): Likewise. + * format-tcl.c (format_check): Likewise. + * format-ycp.c (format_check): Likewise. + * format.c (check_msgid_msgstr_format_i): Pass either "msgid" or + "msgid_plural" as pretty_msgid argument. + 2009-05-23 Bruno Haible <bruno@clisp.org> * Makefile.am (libgettextsrc_la_LINK, msgattrib_LINK, msgcat_LINK, diff --git a/gettext-tools/src/format-awk.c b/gettext-tools/src/format-awk.c index 10796e7..e931bea 100644 --- a/gettext-tools/src/format-awk.c +++ b/gettext-tools/src/format-awk.c @@ -1,5 +1,5 @@ /* awk format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2002. This program is free software: you can redistribute it and/or modify @@ -481,7 +481,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -506,8 +506,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -536,8 +537,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-boost.c b/gettext-tools/src/format-boost.c index b4696ca..b24d7f6 100644 --- a/gettext-tools/src/format-boost.c +++ b/gettext-tools/src/format-boost.c @@ -1,5 +1,5 @@ /* Boost format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -589,7 +589,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -614,8 +614,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -644,8 +645,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-c.c b/gettext-tools/src/format-c.c index 2f1b820..0259527 100644 --- a/gettext-tools/src/format-c.c +++ b/gettext-tools/src/format-c.c @@ -1,5 +1,5 @@ /* C format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -885,7 +885,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -898,8 +898,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, : spec1->unnumbered_arg_count < spec2->unnumbered_arg_count) { if (error_logger) - error_logger (_("number of format specifications in 'msgid' and '%s' does not match"), - pretty_msgstr); + error_logger (_("number of format specifications in '%s' and '%s' does not match"), + pretty_msgid, pretty_msgstr); err = true; } else @@ -907,8 +907,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->unnumbered[i].type != spec2->unnumbered[i].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, i + 1); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, i + 1); err = true; } diff --git a/gettext-tools/src/format-csharp.c b/gettext-tools/src/format-csharp.c index aecde34..b054aa6 100644 --- a/gettext-tools/src/format-csharp.c +++ b/gettext-tools/src/format-csharp.c @@ -1,5 +1,5 @@ /* C# format strings. - Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -191,7 +191,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -203,8 +203,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, : spec1->numbered_arg_count < spec2->numbered_arg_count) { if (error_logger) - error_logger (_("number of format specifications in 'msgid' and '%s' does not match"), - pretty_msgstr); + error_logger (_("number of format specifications in '%s' and '%s' does not match"), + pretty_msgid, pretty_msgstr); err = true; } diff --git a/gettext-tools/src/format-elisp.c b/gettext-tools/src/format-elisp.c index 737c77e..c6f2f1e 100644 --- a/gettext-tools/src/format-elisp.c +++ b/gettext-tools/src/format-elisp.c @@ -1,5 +1,5 @@ /* Emacs Lisp format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2002. This program is free software: you can redistribute it and/or modify @@ -320,7 +320,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -345,8 +345,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -375,8 +376,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-gcc-internal.c b/gettext-tools/src/format-gcc-internal.c index 254929b..15510ba 100644 --- a/gettext-tools/src/format-gcc-internal.c +++ b/gettext-tools/src/format-gcc-internal.c @@ -1,5 +1,5 @@ /* GCC internal format strings. - Copyright (C) 2003-2008 Free Software Foundation, Inc. + Copyright (C) 2003-2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -599,7 +599,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -624,8 +624,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -654,8 +655,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } @@ -672,11 +674,11 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (error_logger) { if (spec1->uses_err_no) - error_logger (_("'msgid' uses %%m but '%s' doesn't"), - pretty_msgstr); + error_logger (_("'%s' uses %%m but '%s' doesn't"), + pretty_msgid, pretty_msgstr); else - error_logger (_("'msgid' does not use %%m but '%s' uses %%m"), - pretty_msgstr); + error_logger (_("'%s' does not use %%m but '%s' uses %%m"), + pretty_msgid, pretty_msgstr); } err = true; } diff --git a/gettext-tools/src/format-gfc-internal.c b/gettext-tools/src/format-gfc-internal.c index 2987e3e..ebe9dde 100644 --- a/gettext-tools/src/format-gfc-internal.c +++ b/gettext-tools/src/format-gfc-internal.c @@ -347,7 +347,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -360,8 +360,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, : spec1->unnumbered_arg_count < spec2->unnumbered_arg_count) { if (error_logger) - error_logger (_("number of format specifications in 'msgid' and '%s' does not match"), - pretty_msgstr); + error_logger (_("number of format specifications in '%s' and '%s' does not match"), + pretty_msgid, pretty_msgstr); err = true; } else @@ -369,8 +369,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->unnumbered[i].type != spec2->unnumbered[i].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, i + 1); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, i + 1); err = true; } @@ -380,11 +380,11 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (error_logger) { if (spec1->uses_currentloc) - error_logger (_("'msgid' uses %%C but '%s' doesn't"), - pretty_msgstr); + error_logger (_("'%s' uses %%C but '%s' doesn't"), + pretty_msgid, pretty_msgstr); else - error_logger (_("'msgid' does not use %%C but '%s' uses %%C"), - pretty_msgstr); + error_logger (_("'%s' does not use %%C but '%s' uses %%C"), + pretty_msgid, pretty_msgstr); } err = true; } diff --git a/gettext-tools/src/format-java.c b/gettext-tools/src/format-java.c index 02afdba..dfc757e 100644 --- a/gettext-tools/src/format-java.c +++ b/gettext-tools/src/format-java.c @@ -1,5 +1,5 @@ /* Java format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -717,7 +717,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -742,8 +742,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument {%u}, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument {%u}, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -772,8 +773,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument {%u} are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument {%u} are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-kde.c b/gettext-tools/src/format-kde.c index d696e63..f08576c 100644 --- a/gettext-tools/src/format-kde.c +++ b/gettext-tools/src/format-kde.c @@ -1,5 +1,5 @@ /* KDE format strings. - Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify @@ -194,7 +194,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -220,8 +220,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -239,7 +240,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, { if (error_logger) error_logger (_("a format specification for arguments %u and %u doesn't exist in '%s', only one argument may be ignored"), - missing, spec1->numbered[i].number, pretty_msgstr); + missing, spec1->numbered[i].number, + pretty_msgstr); err = true; break; } diff --git a/gettext-tools/src/format-librep.c b/gettext-tools/src/format-librep.c index 5d0009e..667a653 100644 --- a/gettext-tools/src/format-librep.c +++ b/gettext-tools/src/format-librep.c @@ -1,5 +1,5 @@ /* librep format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -284,7 +284,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -309,8 +309,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -339,8 +340,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-lisp.c b/gettext-tools/src/format-lisp.c index 840db83..cf155ed 100644 --- a/gettext-tools/src/format-lisp.c +++ b/gettext-tools/src/format-lisp.c @@ -1,5 +1,5 @@ /* Lisp format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -3460,7 +3460,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -3471,8 +3471,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (!equal_list (spec1->list, spec2->list)) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' are not equivalent"), - pretty_msgstr); + error_logger (_("format specifications in '%s' and '%s' are not equivalent"), + pretty_msgid, pretty_msgstr); err = true; } } @@ -3487,8 +3487,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, equal_list (intersection, spec2->list)))) { if (error_logger) - error_logger (_("format specifications in '%s' are not a subset of those in 'msgid'"), - pretty_msgstr); + error_logger (_("format specifications in '%s' are not a subset of those in '%s'"), + pretty_msgstr, pretty_msgid); err = true; } } diff --git a/gettext-tools/src/format-pascal.c b/gettext-tools/src/format-pascal.c index f0178fa..be5e3cc 100644 --- a/gettext-tools/src/format-pascal.c +++ b/gettext-tools/src/format-pascal.c @@ -1,5 +1,5 @@ /* Object Pascal format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -373,7 +373,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -398,8 +398,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -428,8 +429,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-perl-brace.c b/gettext-tools/src/format-perl-brace.c index df2e0c0..65f9d20 100644 --- a/gettext-tools/src/format-perl-brace.c +++ b/gettext-tools/src/format-perl-brace.c @@ -167,7 +167,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; diff --git a/gettext-tools/src/format-perl.c b/gettext-tools/src/format-perl.c index bd2cf75..7a7dbc3 100644 --- a/gettext-tools/src/format-perl.c +++ b/gettext-tools/src/format-perl.c @@ -1,5 +1,5 @@ /* Perl format strings. - Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -556,7 +556,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -581,8 +581,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -611,8 +612,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-php.c b/gettext-tools/src/format-php.c index ef3d788..19735cb 100644 --- a/gettext-tools/src/format-php.c +++ b/gettext-tools/src/format-php.c @@ -1,5 +1,5 @@ /* PHP format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify @@ -322,7 +322,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -347,8 +347,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -377,8 +378,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-python.c b/gettext-tools/src/format-python.c index 889f732..55dbf16 100644 --- a/gettext-tools/src/format-python.c +++ b/gettext-tools/src/format-python.c @@ -1,5 +1,5 @@ /* Python format strings. - Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -418,7 +418,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -427,15 +427,15 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->named_arg_count > 0 && spec2->unnamed_arg_count > 0) { if (error_logger) - error_logger (_("format specifications in 'msgid' expect a mapping, those in '%s' expect a tuple"), - pretty_msgstr); + error_logger (_("format specifications in '%s' expect a mapping, those in '%s' expect a tuple"), + pretty_msgid, pretty_msgstr); err = true; } else if (spec1->unnamed_arg_count > 0 && spec2->named_arg_count > 0) { if (error_logger) - error_logger (_("format specifications in 'msgid' expect a tuple, those in '%s' expect a mapping"), - pretty_msgstr); + error_logger (_("format specifications in '%s' expect a tuple, those in '%s' expect a mapping"), + pretty_msgid, pretty_msgstr); err = true; } else @@ -457,8 +457,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument '%s', as in '%s', doesn't exist in 'msgid'"), - spec2->named[j].name, pretty_msgstr); + error_logger (_("a format specification for argument '%s', as in '%s', doesn't exist in '%s'"), + spec2->named[j].name, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -490,8 +491,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, || spec2->named[j].type == FAT_ANY)))) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument '%s' are not the same"), - pretty_msgstr, spec2->named[j].name); + error_logger (_("format specifications in '%s' and '%s' for argument '%s' are not the same"), + pretty_msgid, pretty_msgstr, + spec2->named[j].name); err = true; break; } @@ -510,8 +512,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->unnamed_arg_count != spec2->unnamed_arg_count) { if (error_logger) - error_logger (_("number of format specifications in 'msgid' and '%s' does not match"), - pretty_msgstr); + error_logger (_("number of format specifications in '%s' and '%s' does not match"), + pretty_msgid, pretty_msgstr); err = true; } else @@ -522,8 +524,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, || spec2->unnamed[i].type == FAT_ANY)))) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, i + 1); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, i + 1); err = true; } } diff --git a/gettext-tools/src/format-qt-plural.c b/gettext-tools/src/format-qt-plural.c index 8b225fd..b224253 100644 --- a/gettext-tools/src/format-qt-plural.c +++ b/gettext-tools/src/format-qt-plural.c @@ -96,7 +96,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -107,8 +107,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, || (equality && spec1->directives > 0 && spec2->directives == 0)) { if (error_logger) - error_logger (_("number of format specifications in 'msgid' and '%s' does not match"), - pretty_msgstr); + error_logger (_("number of format specifications in '%s' and '%s' does not match"), + pretty_msgid, pretty_msgstr); err = true; } diff --git a/gettext-tools/src/format-qt.c b/gettext-tools/src/format-qt.c index 0573489..2296d86 100644 --- a/gettext-tools/src/format-qt.c +++ b/gettext-tools/src/format-qt.c @@ -1,5 +1,5 @@ /* Qt format strings. - Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -139,7 +139,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -149,8 +149,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->simple && !spec2->simple) { if (error_logger) - error_logger (_("'msgid' is a simple format string, but '%s' is not: it contains an 'L' flag or a double-digit argument number"), - pretty_msgstr); + error_logger (_("'%s' is a simple format string, but '%s' is not: it contains an 'L' flag or a double-digit argument number"), + pretty_msgid, pretty_msgstr); err = true; } @@ -165,10 +165,14 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (arg_used1 != arg_used2) { if (error_logger) - error_logger (arg_used1 - ? _("a format specification for argument %u doesn't exist in '%s'") - : _("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - i, pretty_msgstr); + { + if (arg_used1) + error_logger (_("a format specification for argument %u doesn't exist in '%s'"), + i, pretty_msgstr); + else + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + i, pretty_msgstr, pretty_msgid); + } err = true; break; } diff --git a/gettext-tools/src/format-scheme.c b/gettext-tools/src/format-scheme.c index 0f80573..77ec7fb 100644 --- a/gettext-tools/src/format-scheme.c +++ b/gettext-tools/src/format-scheme.c @@ -1,5 +1,5 @@ /* Scheme format strings. - Copyright (C) 2001-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -3383,7 +3383,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -3394,8 +3394,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (!equal_list (spec1->list, spec2->list)) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' are not equivalent"), - pretty_msgstr); + error_logger (_("format specifications in '%s' and '%s' are not equivalent"), + pretty_msgid, pretty_msgstr); err = true; } } @@ -3410,8 +3410,8 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, equal_list (intersection, spec2->list)))) { if (error_logger) - error_logger (_("format specifications in '%s' are not a subset of those in 'msgid'"), - pretty_msgstr); + error_logger (_("format specifications in '%s' are not a subset of those in '%s'"), + pretty_msgstr, pretty_msgid); err = true; } } diff --git a/gettext-tools/src/format-sh.c b/gettext-tools/src/format-sh.c index 991a1fe..5a7494e 100644 --- a/gettext-tools/src/format-sh.c +++ b/gettext-tools/src/format-sh.c @@ -1,5 +1,5 @@ /* Shell format strings. - Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -271,7 +271,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -294,8 +294,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument '%s', as in '%s', doesn't exist in 'msgid'"), - spec2->named[j].name, pretty_msgstr); + error_logger (_("a format specification for argument '%s', as in '%s', doesn't exist in '%s'"), + spec2->named[j].name, pretty_msgstr, + pretty_msgid); err = true; break; } diff --git a/gettext-tools/src/format-tcl.c b/gettext-tools/src/format-tcl.c index c7aecc1..6549cdf 100644 --- a/gettext-tools/src/format-tcl.c +++ b/gettext-tools/src/format-tcl.c @@ -1,5 +1,5 @@ /* Tcl format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2002. This program is free software: you can redistribute it and/or modify @@ -362,7 +362,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -387,8 +387,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (cmp > 0) { if (error_logger) - error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - spec2->numbered[j].number, pretty_msgstr); + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + spec2->numbered[j].number, pretty_msgstr, + pretty_msgid); err = true; break; } @@ -417,8 +418,9 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (spec1->numbered[i].type != spec2->numbered[j].type) { if (error_logger) - error_logger (_("format specifications in 'msgid' and '%s' for argument %u are not the same"), - pretty_msgstr, spec2->numbered[j].number); + error_logger (_("format specifications in '%s' and '%s' for argument %u are not the same"), + pretty_msgid, pretty_msgstr, + spec2->numbered[j].number); err = true; break; } diff --git a/gettext-tools/src/format-ycp.c b/gettext-tools/src/format-ycp.c index e30c15e..193f216 100644 --- a/gettext-tools/src/format-ycp.c +++ b/gettext-tools/src/format-ycp.c @@ -1,5 +1,5 @@ /* YCP and Smalltalk format strings. - Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -124,7 +124,7 @@ format_get_number_of_directives (void *descr) static bool format_check (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, - const char *pretty_msgstr) + const char *pretty_msgid, const char *pretty_msgstr) { struct spec *spec1 = (struct spec *) msgid_descr; struct spec *spec2 = (struct spec *) msgstr_descr; @@ -139,10 +139,14 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality, if (equality ? (arg_used1 != arg_used2) : (!arg_used1 && arg_used2)) { if (error_logger) - error_logger (arg_used1 - ? _("a format specification for argument %u doesn't exist in '%s'") - : _("a format specification for argument %u, as in '%s', doesn't exist in 'msgid'"), - i + 1, pretty_msgstr); + { + if (arg_used1) + error_logger (_("a format specification for argument %u doesn't exist in '%s'"), + i + 1, pretty_msgstr); + else + error_logger (_("a format specification for argument %u, as in '%s', doesn't exist in '%s'"), + i + 1, pretty_msgstr, pretty_msgid); + } err = true; break; } diff --git a/gettext-tools/src/format.c b/gettext-tools/src/format.c index 68f5fe8..846ae64 100644 --- a/gettext-tools/src/format.c +++ b/gettext-tools/src/format.c @@ -91,6 +91,8 @@ check_msgid_msgstr_format_i (const char *msgid, const char *msgid_plural, if (msgid_descr != NULL) { + const char *pretty_msgid = + (msgid_plural != NULL ? "msgid_plural" : "msgid"); char buf[18+1]; const char *pretty_msgstr = "msgstr"; bool has_plural_translations = (strlen (msgstr) + 1 < msgstr_len); @@ -136,7 +138,7 @@ check_msgid_msgstr_format_i (const char *msgid, const char *msgid_plural, if (parser->check (msgid_descr, msgstr_descr, strict_checking, - error_logger, pretty_msgstr)) + error_logger, pretty_msgid, pretty_msgstr)) seen_errors++; parser->free (msgstr_descr); @@ -144,9 +146,9 @@ check_msgid_msgstr_format_i (const char *msgid, const char *msgid_plural, else { error_logger (_("\ -'%s' is not a valid %s format string, unlike 'msgid'. Reason: %s"), +'%s' is not a valid %s format string, unlike '%s'. Reason: %s"), pretty_msgstr, format_language_pretty[i], - invalid_reason); + pretty_msgid, invalid_reason); seen_errors++; free (invalid_reason); } diff --git a/gettext-tools/src/format.h b/gettext-tools/src/format.h index 136c963..ac6ca2e 100644 --- a/gettext-tools/src/format.h +++ b/gettext-tools/src/format.h @@ -91,7 +91,7 @@ struct formatstring_parser msgstr_descr may omit some of the arguments of msgid_descr). If not, signal an error using error_logger (only if error_logger != NULL) and return true. Otherwise return false. */ - bool (*check) (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, const char *pretty_msgstr); + bool (*check) (void *msgid_descr, void *msgstr_descr, bool equality, formatstring_error_logger_t error_logger, const char *pretty_msgid, const char *pretty_msgstr); }; /* Format string parsers, each defined in its own file. */ |