]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgmerge now marks a message fuzzy if it adds a c-format bit and the message
authorBruno Haible <bruno@clisp.org>
Mon, 10 Dec 2001 12:53:51 +0000 (12:53 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:36:24 +0000 (23:36 +0200)
does not yet correctly pass the format check.

13 files changed:
src/ChangeLog
src/format-c.c
src/format-java.c
src/format-lisp.c
src/format-pascal.c
src/format-python.c
src/format-ycp.c
src/format.h
src/message.c
src/msgfmt.c
tests/ChangeLog
tests/Makefile.am
tests/msgmerge-20 [new file with mode: 0755]

index 898b363025829c20fd09a94f9fdaa6e1d9d65471..367833905abd503966d03d679af206b7ce794beb 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-06  Bruno Haible  <bruno@clisp.org>
+
+       * format.h (struct formatstring_parser): Add 'noisy' argument to
+       'check' field.
+       * format-c.c (format_check): Add 'noisy' argument.
+       * format-java.c (format_check): Likewise.
+       * format-lisp.c (format_check): Likewise.
+       * format-pascal.c (format_check): Likewise.
+       * format-python.c (format_check): Likewise.
+       * format-ycp.c (format_check): Likewise.
+       * msgfmt.c (check_pair): Pass noisy=true.
+       * message.c: Include format.h.
+       (msgfmt_check_pair_fails): New function.
+       (message_merge): Set fuzzy flag when adding a -format specifier that
+       needs the translator's attention.
+
 2001-12-10  Bruno Haible  <bruno@clisp.org>
 
        * x-java.l (tailcmp): If s1 ends with s2, it must be either equal to
index 926a19243a4ab3dbcf322e1217d482dc089dc30b..5abf9a6ac472ca942dbe080e9db6c25fee4093e6 100644 (file)
@@ -141,7 +141,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 static int
@@ -560,10 +561,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -573,21 +575,27 @@ format_check (pos, msgid_descr, msgstr_descr)
   /* Check the argument types are the same.  */
   if (spec1->unnumbered_arg_count != spec2->unnumbered_arg_count)
     {
-      error_with_progname = false;
-      error_at_line (0, 0, pos->file_name, pos->line_number,
-                    _("number of format specifications in 'msgid' and 'msgstr' does not match"));
-      error_with_progname = true;
+      if (noisy)
+       {
+         error_with_progname = false;
+         error_at_line (0, 0, pos->file_name, pos->line_number,
+                        _("number of format specifications in 'msgid' and 'msgstr' does not match"));
+         error_with_progname = true;
+       }
       err = true;
     }
   else
     for (i = 0; i < spec1->unnumbered_arg_count; i++)
       if (spec1->unnumbered[i].type != spec2->unnumbered[i].type)
        {
-         error_with_progname = false;
-         error_at_line (0, 0, pos->file_name, pos->line_number,
-                        _("format specifications in 'msgid' and 'msgstr' for argument %u are not the same"),
-                        i + 1);
-         error_with_progname = true;
+         if (noisy)
+           {
+             error_with_progname = false;
+             error_at_line (0, 0, pos->file_name, pos->line_number,
+                            _("format specifications in 'msgid' and 'msgstr' for argument %u are not the same"),
+                            i + 1);
+             error_with_progname = true;
+           }
          err = true;
        }
 
index 6dd99843a5017f6aa733f0eb5d51dab17606593e..feaf66ac7c69af842b941e71b8e1b326ab188019 100644 (file)
@@ -139,7 +139,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 /* Quote handling:
@@ -621,10 +622,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -647,21 +649,27 @@ format_check (pos, msgid_descr, msgstr_descr)
 
          if (cmp > 0)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("a format specification for argument {%u} doesn't exist in 'msgid'"),
-                            spec2->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("a format specification for argument {%u} doesn't exist in 'msgid'"),
+                                spec2->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
          else if (cmp < 0)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("a format specification for argument {%u} doesn't exist in 'msgstr'"),
-                            spec1->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("a format specification for argument {%u} doesn't exist in 'msgstr'"),
+                                spec1->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
@@ -671,11 +679,14 @@ format_check (pos, msgid_descr, msgstr_descr)
        for (i = 0; i < spec2->numbered_arg_count; i++)
          if (spec1->numbered[i].type != spec2->numbered[i].type)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("format specifications in 'msgid' and 'msgstr' for argument {%u} are not the same"),
-                            spec2->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("format specifications in 'msgid' and 'msgstr' for argument {%u} are not the same"),
+                                spec2->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
index e2c4df913d3eded24f07e5298be9be10b3619519..26d7595b0d4b21d4c6a4c30fa24bff0a597b38b3 100644 (file)
@@ -229,7 +229,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 /* ======================= Verify a format_arg_list ======================= */
@@ -3355,10 +3356,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -3366,10 +3368,13 @@ format_check (pos, msgid_descr, msgstr_descr)
 
   if (!equal_list (spec1->list, spec2->list))
     {
-      error_with_progname = false;
-      error_at_line (0, 0, pos->file_name, pos->line_number,
-                    _("format specifications in 'msgid' and 'msgstr' are not equivalent"));
-      error_with_progname = true;
+      if (noisy)
+       {
+         error_with_progname = false;
+         error_at_line (0, 0, pos->file_name, pos->line_number,
+                        _("format specifications in 'msgid' and 'msgstr' are not equivalent"));
+         error_with_progname = true;
+       }
       err = true;
     }
 
index 38243d136de49f2dff217d35f4e7008c78362fcd..de06431c6827b9d6bfa425e18335a161ecdf36d9 100644 (file)
@@ -101,7 +101,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 static int
@@ -365,10 +366,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -391,21 +393,27 @@ format_check (pos, msgid_descr, msgstr_descr)
 
          if (cmp > 0)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("a format specification for argument {%u} doesn't exist in 'msgid'"),
-                            spec2->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("a format specification for argument {%u} doesn't exist in 'msgid'"),
+                                spec2->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
          else if (cmp < 0)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("a format specification for argument {%u} doesn't exist in 'msgstr'"),
-                            spec1->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("a format specification for argument {%u} doesn't exist in 'msgstr'"),
+                                spec1->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
@@ -415,11 +423,14 @@ format_check (pos, msgid_descr, msgstr_descr)
        for (i = 0; i < spec2->numbered_arg_count; i++)
          if (spec1->numbered[i].type != spec2->numbered[i].type)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("format specifications in 'msgid' and 'msgstr' for argument {%u} are not the same"),
-                            spec2->numbered[i].number);
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("format specifications in 'msgid' and 'msgstr' for argument {%u} are not the same"),
+                                spec2->numbered[i].number);
+                 error_with_progname = true;
+               }
              err = true;
              break;
            }
index 09bcb7eb26f6051a2b70e0b7006e259c16c7321e..ab47d10c507cc8ec65031a9ccae03acc8d7207ac 100644 (file)
@@ -109,7 +109,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 static int
@@ -375,10 +376,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -386,18 +388,24 @@ format_check (pos, msgid_descr, msgstr_descr)
 
   if (spec1->named_arg_count > 0 && spec2->unnamed_arg_count > 0)
     {
-      error_with_progname = false;
-      error_at_line (0, 0, pos->file_name, pos->line_number,
-                    _("format specifications in 'msgid' expect a mapping, those in 'msgstr' expect a tuple"));
-      error_with_progname = true;
+      if (noisy)
+       {
+         error_with_progname = false;
+         error_at_line (0, 0, pos->file_name, pos->line_number,
+                        _("format specifications in 'msgid' expect a mapping, those in 'msgstr' expect a tuple"));
+         error_with_progname = true;
+       }
       err = true;
     }
   else if (spec1->unnamed_arg_count > 0 && spec2->named_arg_count > 0)
     {
-      error_with_progname = false;
-      error_at_line (0, 0, pos->file_name, pos->line_number,
-                    _("format specifications in 'msgid' expect a tuple, those in 'msgstr' expect a mapping"));
-      error_with_progname = true;
+      if (noisy)
+       {
+         error_with_progname = false;
+         error_at_line (0, 0, pos->file_name, pos->line_number,
+                        _("format specifications in 'msgid' expect a tuple, those in 'msgstr' expect a mapping"));
+         error_with_progname = true;
+       }
       err = true;
     }
   else
@@ -417,21 +425,27 @@ format_check (pos, msgid_descr, msgstr_descr)
 
              if (cmp > 0)
                {
-                 error_with_progname = false;
-                 error_at_line (0, 0, pos->file_name, pos->line_number,
-                                _("a format specification for argument '%s' doesn't exist in 'msgid'"),
-                                spec2->named[i].name);
-                 error_with_progname = true;
+                 if (noisy)
+                   {
+                     error_with_progname = false;
+                     error_at_line (0, 0, pos->file_name, pos->line_number,
+                                    _("a format specification for argument '%s' doesn't exist in 'msgid'"),
+                                    spec2->named[i].name);
+                     error_with_progname = true;
+                   }
                  err = true;
                  break;
                }
              else if (cmp < 0)
                {
-                 error_with_progname = false;
-                 error_at_line (0, 0, pos->file_name, pos->line_number,
-                                _("a format specification for argument '%s' doesn't exist in 'msgstr'"),
-                                spec1->named[i].name);
-                 error_with_progname = true;
+                 if (noisy)
+                   {
+                     error_with_progname = false;
+                     error_at_line (0, 0, pos->file_name, pos->line_number,
+                                    _("a format specification for argument '%s' doesn't exist in 'msgstr'"),
+                                    spec1->named[i].name);
+                     error_with_progname = true;
+                   }
                  err = true;
                  break;
                }
@@ -441,11 +455,14 @@ format_check (pos, msgid_descr, msgstr_descr)
            for (i = 0; i < spec2->named_arg_count; i++)
              if (spec1->named[i].type != spec2->named[i].type)
                {
-                 error_with_progname = false;
-                 error_at_line (0, 0, pos->file_name, pos->line_number,
-                                _("format specifications in 'msgid' and 'msgstr' for argument '%s' are not the same"),
-                                spec2->named[i].name);
-                 error_with_progname = true;
+                 if (noisy)
+                   {
+                     error_with_progname = false;
+                     error_at_line (0, 0, pos->file_name, pos->line_number,
+                                    _("format specifications in 'msgid' and 'msgstr' for argument '%s' are not the same"),
+                                    spec2->named[i].name);
+                     error_with_progname = true;
+                   }
                  err = true;
                  break;
                }
@@ -458,21 +475,27 @@ format_check (pos, msgid_descr, msgstr_descr)
          /* Check the argument types are the same.  */
          if (spec1->unnamed_arg_count != spec2->unnamed_arg_count)
            {
-             error_with_progname = false;
-             error_at_line (0, 0, pos->file_name, pos->line_number,
-                            _("number of format specifications in 'msgid' and 'msgstr' does not match"));
-             error_with_progname = true;
+             if (noisy)
+               {
+                 error_with_progname = false;
+                 error_at_line (0, 0, pos->file_name, pos->line_number,
+                                _("number of format specifications in 'msgid' and 'msgstr' does not match"));
+                 error_with_progname = true;
+               }
              err = true;
            }
          else
            for (i = 0; i < spec1->unnamed_arg_count; i++)
              if (spec1->unnamed[i].type != spec2->unnamed[i].type)
                {
-                 error_with_progname = false;
-                 error_at_line (0, 0, pos->file_name, pos->line_number,
-                                _("format specifications in 'msgid' and 'msgstr' for argument %u are not the same"),
-                                i + 1);
-                 error_with_progname = true;
+                 if (noisy)
+                   {
+                     error_with_progname = false;
+                     error_at_line (0, 0, pos->file_name, pos->line_number,
+                                    _("format specifications in 'msgid' and 'msgstr' for argument %u are not the same"),
+                                    i + 1);
+                     error_with_progname = true;
+                   }
                  err = true;
                }
        }
index dd4b7089aa236615bd3acc671fdb4d31f48cc5ed..dbd9e6a352740760a67705eb057ba2075cd60234 100644 (file)
@@ -52,7 +52,8 @@ static void *format_parse PARAMS ((const char *format));
 static void format_free PARAMS ((void *descr));
 static int format_get_number_of_directives PARAMS ((void *descr));
 static bool format_check PARAMS ((const lex_pos_ty *pos,
-                                 void *msgid_descr, void *msgstr_descr));
+                                 void *msgid_descr, void *msgstr_descr,
+                                 bool noisy));
 
 
 static void *
@@ -114,10 +115,11 @@ format_get_number_of_directives (descr)
 }
 
 static bool
-format_check (pos, msgid_descr, msgstr_descr)
+format_check (pos, msgid_descr, msgstr_descr, noisy)
      const lex_pos_ty *pos;
      void *msgid_descr;
      void *msgstr_descr;
+     bool noisy;
 {
   struct spec *spec1 = (struct spec *) msgid_descr;
   struct spec *spec2 = (struct spec *) msgstr_descr;
@@ -131,13 +133,16 @@ format_check (pos, msgid_descr, msgstr_descr)
 
       if (arg_used1 != arg_used2)
        {
-         error_with_progname = false;
-         error_at_line (0, 0, pos->file_name, pos->line_number,
-                        arg_used1
-                        ? _("a format specification for argument %u doesn't exist in 'msgstr'")
-                        : _("a format specification for argument %u doesn't exist in 'msgid'"),
-                        i + 1);
-         error_with_progname = true;
+         if (noisy)
+           {
+             error_with_progname = false;
+             error_at_line (0, 0, pos->file_name, pos->line_number,
+                            arg_used1
+                            ? _("a format specification for argument %u doesn't exist in 'msgstr'")
+                            : _("a format specification for argument %u doesn't exist in 'msgid'"),
+                            i + 1);
+             error_with_progname = true;
+           }
          err = true;
          break;
        }
index 58e730ee2cb30cc39ccb478bf2e064158bebda2c..cb925ff6c90c036d0356c7f8e90be1e40a781a82 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef _FORMAT_H
 #define _FORMAT_H
 
+#include <stdbool.h>
+
 #include "pos.h"       /* Get lex_pos_ty.  */
 #include "message.h"   /* Get NFORMATS.  */
 
@@ -44,8 +46,8 @@ struct formatstring_parser
        error_with_progname = false;
        error_at_line (0, 0, pos->file_name, pos->line_number, ...);
        error_with_progname = true;
-     and return true.  Otherwise return false.  */
-  bool (*check) PARAMS ((const lex_pos_ty *pos, void *msgid_descr, void *msgstr_descr));
+     (but only if noisy=true) and return true.  Otherwise return false.  */
+  bool (*check) PARAMS ((const lex_pos_ty *pos, void *msgid_descr, void *msgstr_descr, bool noisy));
 };
 
 /* Format string parsers, each defined in its own file.  */
index 0f19e202d53ac1dba8a388fb9673133189ca042e..2b6c39c38fb5320a66659219522dbb69d2558c04 100644 (file)
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "fstrcmp.h"
 #include "hash.h"
+#include "format.h"
 #include "xmalloc.h"
 #include "strstr.h"
 #include "system.h"
@@ -36,6 +37,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Prototypes for local functions.  Needed to ensure compiler checking of
    function argument counts despite of K&R C function definition syntax.  */
+static bool msgfmt_check_pair_fails PARAMS ((const lex_pos_ty *pos,
+                                            const char *msgid,
+                                            const char *msgstr, size_t i));
 static message_ty *message_list_search_fuzzy_inner PARAMS ((
        message_list_ty *mlp, const char *msgid, double *best_weight_p));
 
@@ -208,6 +212,37 @@ message_copy (mp)
 }
 
 
+static bool
+msgfmt_check_pair_fails (pos, msgid, msgstr, i)
+     const lex_pos_ty *pos;
+     const char *msgid;
+     const char *msgstr;
+     size_t i;
+{
+  bool failure;
+  struct formatstring_parser *parser = formatstring_parsers[i];
+  void *msgid_descr = parser->parse (msgid);
+
+  if (msgid_descr != NULL)
+    {
+      void *msgstr_descr = parser->parse (msgstr);
+
+      if (msgstr_descr != NULL)
+       {
+         failure = parser->check (pos, msgid_descr, msgstr_descr, false);
+         parser->free (msgstr_descr);
+       }
+      else
+       failure = true;
+
+      parser->free (msgid_descr);
+    }
+  else
+    failure = false;
+
+  return failure;
+}
+
 message_ty *
 message_merge (def, ref)
      message_ty *def;
@@ -407,8 +442,26 @@ message_merge (def, ref)
      from the reference message (such as format/no-format), others
      come from the definition file (fuzzy or not).  */
   result->is_fuzzy = def->is_fuzzy;
+
   for (i = 0; i < NFORMATS; i++)
-    result->is_format[i] = ref->is_format[i];
+    {
+      result->is_format[i] = ref->is_format[i];
+
+      /* If the reference message is marked as being a format specifier,
+        but the definition message is not, we check if the resulting
+        message would pass "msgfmt -c".  If yes, then all is fine.  If
+        not, we add a fuzzy marker, because
+        1. the message needs the translator's attention,
+        2. msgmerge must not transform a PO file which passes "msgfmt -c"
+           into a PO file which doesn't.  */
+      if (!result->is_fuzzy
+         && ref->msgid_plural == NULL
+         && possible_format_p (ref->is_format[i])
+         && !possible_format_p (def->is_format[i])
+         && msgfmt_check_pair_fails (&def->pos, ref->msgid, msgstr, i))
+       result->is_fuzzy = true;
+    }
+
   result->do_wrap = ref->do_wrap;
 
   /* Take the file position comments from the reference file, as they
index 811f525aa35ed8182012bd8ea44f9a2f3aec64de..01794a2b22b0a511ae0f31f1c9ea0fbb47e9620e 100644 (file)
@@ -1075,7 +1075,8 @@ check_pair (msgid, msgid_pos, msgid_plural, msgstr, msgstr_len, msgstr_pos,
 
              if (msgstr_descr != NULL)
                {
-                 if (parser->check (msgid_pos, msgid_descr, msgstr_descr))
+                 if (parser->check (msgid_pos, msgid_descr, msgstr_descr,
+                                    true))
                    exit_status = EXIT_FAILURE;
 
                  parser->free (msgstr_descr);
index ff59b4335f85967eaf67b8f1c7a21b589831b813..428854b87b9c4a4daabe7589e0b2c2595b0702ba 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-06  Bruno Haible  <bruno@clisp.org>
+
+       * msgmerge-20: New file.
+       * Makefile.am (TESTS): Add it.
+
 2001-12-03  Bruno Haible  <bruno@clisp.org>
 
        * lang-java: Pass --omit-header --no-location to xgettext.
index f2c594b87f676e179890a48d62fba3b48af1d4d5..0fa877185cf5e7c3e6957b46c8cefb3f0ba6b4ae 100644 (file)
@@ -31,7 +31,7 @@ TESTS = gettext-1 gettext-2 \
        msgmerge-1 msgmerge-2 msgmerge-3 msgmerge-4 msgmerge-5 msgmerge-6 \
        msgmerge-7 msgmerge-8 msgmerge-9 msgmerge-10 msgmerge-11 msgmerge-12 \
        msgmerge-13 msgmerge-14 msgmerge-15 msgmerge-16 msgmerge-17 \
-       msgmerge-18 msgmerge-19 \
+       msgmerge-18 msgmerge-19 msgmerge-20 \
        msgunfmt-1 \
        msguniq-1 msguniq-2 msguniq-3 \
        xgettext-1 xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \
diff --git a/tests/msgmerge-20 b/tests/msgmerge-20
new file mode 100755 (executable)
index 0000000..4cf48d3
--- /dev/null
@@ -0,0 +1,141 @@
+#! /bin/sh
+
+# Test merging of a message which has c-format specified in ref.pot but not
+# in def.po.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles mm-test20.po"
+cat <<EOF > mm-test20.po
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cog_training 1.0\n"
+"POT-Creation-Date: 2001-04-29 22:40+0200\n"
+"PO-Revision-Date: 2001-04-29 21:19+02:00\n"
+"Last-Translator: Felix N. <xyz@zyx.uucp>\n"
+"Language-Team: German <de@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: foobar.c:11
+#, c-format
+msgid "file named %s"
+msgstr "Datei namens %s"
+
+#: foobar.c:12
+#, c-format
+msgid "directory named %s"
+msgstr "Verzeichnis namens %s"
+
+#: foobar.c:13
+msgid "result %s"
+msgstr "Ergebnis %s"
+
+#: foobar.c:14
+msgid "intermediate result %s"
+msgstr "Zwischenergebnis %d"
+
+#: foobar.c:15
+msgid "%age"
+msgstr "%-Satz"
+EOF
+
+tmpfiles="$tmpfiles mm-test20.pot"
+cat <<EOF > mm-test20.pot
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2001-04-30 18:51+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: foobar.c:21
+#, c-format
+msgid "file named %s"
+msgstr ""
+
+#: foobar.c:22
+msgid "directory named %s"
+msgstr ""
+
+#: foobar.c:23
+#, c-format
+msgid "result %s"
+msgstr ""
+
+#: foobar.c:24
+#, c-format
+msgid "intermediate result %s"
+msgstr ""
+
+#: foobar.c:25
+msgid "%age"
+msgstr ""
+EOF
+
+tmpfiles="$tmpfiles mm-test20.out"
+: ${MSGMERGE=msgmerge}
+${MSGMERGE} -q mm-test20.po mm-test20.pot -o mm-test20.out
+
+tmpfiles="$tmpfiles mm-test20.ok"
+cat <<EOF > mm-test20.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cog_training 1.0\n"
+"POT-Creation-Date: 2001-04-30 18:51+0200\n"
+"PO-Revision-Date: 2001-04-29 21:19+02:00\n"
+"Last-Translator: Felix N. <xyz@zyx.uucp>\n"
+"Language-Team: German <de@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: foobar.c:21
+#, c-format
+msgid "file named %s"
+msgstr "Datei namens %s"
+
+#: foobar.c:22
+msgid "directory named %s"
+msgstr "Verzeichnis namens %s"
+
+#: foobar.c:23
+#, c-format
+msgid "result %s"
+msgstr "Ergebnis %s"
+
+#: foobar.c:24
+#, fuzzy, c-format
+msgid "intermediate result %s"
+msgstr "Zwischenergebnis %d"
+
+#: foobar.c:25
+msgid "%age"
+msgstr "%-Satz"
+EOF
+
+: ${DIFF=diff}
+${DIFF} mm-test20.ok mm-test20.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result