From: Bruno Haible Date: Mon, 3 Sep 2001 14:07:41 +0000 (+0000) Subject: Improve msgmerge compendium handling. X-Git-Tag: v0.11~523 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08387fc7257030e019c77dee8ff940c25ff238bd;p=thirdparty%2Fgettext.git Improve msgmerge compendium handling. --- diff --git a/src/ChangeLog b/src/ChangeLog index dccec66fd..e3b4e8cab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-09-01 Bruno Haible + + * message.c (message_list_list_search): If the first match has an + empty translation but there is later in the list a non-empty + translation, return the latter one. This fixes the msgmerge-8 test. + 2001-08-30 Bruno Haible Reorganize msgfmt checking options. diff --git a/src/message.c b/src/message.c index d8aea28da..3857e36bf 100644 --- a/src/message.c +++ b/src/message.c @@ -638,8 +638,12 @@ message_list_list_search (mllp, msgid) message_list_list_ty *mllp; const char *msgid; { + message_ty *best_mp; + int best_weight; /* 0: not found, 1: found without msgstr, 2: translated */ size_t j; + best_mp = NULL; + best_weight = 0; for (j = 0; j < mllp->nitems; ++j) { message_list_ty *mlp; @@ -648,9 +652,16 @@ message_list_list_search (mllp, msgid) mlp = mllp->item[j]; mp = message_list_search (mlp, msgid); if (mp) - return mp; + { + int weight = (mp->msgstr_len == 1 && mp->msgstr[0] == '\0' ? 1 : 2); + if (weight > best_weight) + { + best_mp = mp; + best_weight = weight; + } + } } - return NULL; + return best_mp; }