From: Bruno Haible Date: Mon, 11 Jun 2001 12:12:21 +0000 (+0000) Subject: msgmerge: Keep the header entry even if the .pot file doesn't contain one. X-Git-Tag: v0.11~677 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88133a6530ab382d1b0c9270851ff6236897642d;p=thirdparty%2Fgettext.git msgmerge: Keep the header entry even if the .pot file doesn't contain one. --- diff --git a/src/ChangeLog b/src/ChangeLog index 5eb3bf826..acd84c226 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-06-10 Bruno Haible + + * 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 * msgfmt.c: Change the --strict option to not apply to domain diff --git a/src/message.h b/src/message.h index 5770854de..2cc355f0f 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 c7b5729ca..77dd4000c 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. */