summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-06-11 12:12:21 +0000
committerBruno Haible <bruno@clisp.org>2001-06-11 12:12:21 +0000
commit88133a6530ab382d1b0c9270851ff6236897642d (patch)
treee3e5235e68db824dba62c194cd9d5d37cce55154 /src
parentadd265baa4b9434a44ec6777765c0b50c8b9caaf (diff)
downloadexternal_gettext-88133a6530ab382d1b0c9270851ff6236897642d.zip
external_gettext-88133a6530ab382d1b0c9270851ff6236897642d.tar.gz
external_gettext-88133a6530ab382d1b0c9270851ff6236897642d.tar.bz2
msgmerge: Keep the header entry even if the .pot file doesn't contain one.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/message.h1
-rw-r--r--src/msgmerge.c13
3 files changed, 21 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5eb3bf8..acd84c2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
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
directives, only to the output filename argument.
(struct msg_domain): Add file_name field.
diff --git a/src/message.h b/src/message.h
index 5770854..2cc355f 100644
--- a/src/message.h
+++ b/src/message.h
@@ -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 *,
diff --git a/src/msgmerge.c b/src/msgmerge.c
index c7b5729..77dd400 100644
--- a/src/msgmerge.c
+++ b/src/msgmerge.c
@@ -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. */