]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgmerge: Keep the header entry even if the .pot file doesn't contain one.
authorBruno Haible <bruno@clisp.org>
Mon, 11 Jun 2001 12:12:21 +0000 (12:12 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 11 Jun 2001 12:12:21 +0000 (12:12 +0000)
src/ChangeLog
src/message.h
src/msgmerge.c

index 5eb3bf826af16ff93f876959c6f32cf3f2615bd9..acd84c226ad6f5a83ef8e2669e33f0a2ccd77b8e 100644 (file)
@@ -1,3 +1,10 @@
+2001-06-10  Bruno Haible  <haible@clisp.cons.org>
+
+       * message.h (message_list_prepend): New declaration.
+       * message.c (message_list_prepend): New function.
+       * msgmerge.c (merge): Add a header entry to the ref list if it has
+       none.
+
 2001-06-10  Bruno Haible  <haible@clisp.cons.org>
 
        * msgfmt.c: Change the --strict option to not apply to domain
index 5770854dec88a980ea379f7fe4d5b339cb6c8b20..2cc355f0f0feebbe0cd160be92fca121aa65a786 100644 (file)
@@ -137,6 +137,7 @@ struct message_list_ty
 message_list_ty *message_list_alloc PARAMS ((void));
 void message_list_free PARAMS ((message_list_ty *));
 void message_list_append PARAMS ((message_list_ty *, message_ty *));
+void message_list_prepend PARAMS ((message_list_ty *, message_ty *));
 void message_list_delete_nth PARAMS ((message_list_ty *, size_t));
 message_ty *message_list_search PARAMS ((message_list_ty *, const char *));
 message_ty *message_list_search_fuzzy PARAMS ((message_list_ty *,
index c7b5729cab8ae97dc6b0d7245bfca8dc3bd5ee88..77dd4000c37ff15b8a76aa76222d164642015835 100644 (file)
@@ -367,6 +367,15 @@ merge (fn1, fn2)
   /* This is the references file, created by groping the sources with
      the xgettext program.  */
   ref = read_po_file (fn2);
+  /* Add a dummy header entry, if the references file contains none.  */
+  if (message_list_search (ref, "") == NULL)
+    {
+      static lex_pos_ty pos = { __FILE__, __LINE__ };
+      message_ty *refmsg = message_alloc ("", NULL);
+
+      message_variant_append (refmsg, MESSAGE_DOMAIN_DEFAULT, "", 1, &pos);
+      message_list_prepend (ref, refmsg);
+    }
 
   result = message_list_alloc ();
 
@@ -401,6 +410,10 @@ merge (fn1, fn2)
          continue;
        }
 
+      /* Special treatment for the header entry.  */
+      if (refmsg->msgid[0] == '\0')
+       continue;
+
       /* If the message was not defined at all, try to find a very
         similar message, it could be a typo, or the suggestion may
         help.  */