From: Bruno Haible Date: Thu, 3 Jul 2025 16:56:11 +0000 (+0200) Subject: msgcat, msgen, xgettext: Tweak processing order. X-Git-Tag: v0.26~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=475c199fc9e9b729a99b6ad8abd1414572585cac;p=thirdparty%2Fgettext.git msgcat, msgen, xgettext: Tweak processing order. * gettext-tools/src/msgcat.c (main): Sort the list of messages as the last processing step before writing the PO file. * gettext-tools/src/msgen.c (main): Likewise. * gettext-tools/src/xgettext.c (main): Likewise. --- diff --git a/gettext-tools/src/msgcat.c b/gettext-tools/src/msgcat.c index d438e99ea..de5b2aa7d 100644 --- a/gettext-tools/src/msgcat.c +++ b/gettext-tools/src/msgcat.c @@ -340,16 +340,16 @@ There is NO WARRANTY, to the extent permitted by law.\n\ string_list_free (file_list); + /* Set the Language field in the header. */ + if (catalogname != NULL) + msgdomain_list_set_header_field (result, "Language:", catalogname); + /* Sorting the list of messages. */ if (sort_by_filepos) msgdomain_list_sort_by_filepos (result); else if (sort_by_msgid) msgdomain_list_sort_by_msgid (result); - /* Set the Language field in the header. */ - if (catalogname != NULL) - msgdomain_list_set_header_field (result, "Language:", catalogname); - /* Write the PO file. */ msgdomain_list_print (result, output_file, output_syntax, textmode_xerror_handler, force_po, false); diff --git a/gettext-tools/src/msgen.c b/gettext-tools/src/msgen.c index f9d9b20a6..9fc6a3650 100644 --- a/gettext-tools/src/msgen.c +++ b/gettext-tools/src/msgen.c @@ -284,16 +284,16 @@ There is NO WARRANTY, to the extent permitted by law.\n\ /* Add English translations. */ result = msgdomain_list_english (result); + /* Set the Language field in the header. */ + if (catalogname != NULL) + msgdomain_list_set_header_field (result, "Language:", catalogname); + /* Sort the results. */ if (sort_by_filepos) msgdomain_list_sort_by_filepos (result); else if (sort_by_msgid) msgdomain_list_sort_by_msgid (result); - /* Set the Language field in the header. */ - if (catalogname != NULL) - msgdomain_list_set_header_field (result, "Language:", catalogname); - /* Write the merged message list out. */ msgdomain_list_print (result, output_file, output_syntax, textmode_xerror_handler, force_po, false); diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index e21813a08..11a5c7c88 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -1091,12 +1091,6 @@ xgettext cannot work without keywords to look for")); iconv_close (xgettext_global_source_iconv); #endif - /* Sorting the list of messages. */ - if (sort_by_filepos) - msgdomain_list_sort_by_filepos (mdlp); - else if (sort_by_msgid) - msgdomain_list_sort_by_msgid (mdlp); - /* Check msgid and msgid_plural of messages. */ { int nerrors = 0; @@ -1115,6 +1109,12 @@ xgettext cannot work without keywords to look for")); nerrors); } + /* Sorting the list of messages. */ + if (sort_by_filepos) + msgdomain_list_sort_by_filepos (mdlp); + else if (sort_by_msgid) + msgdomain_list_sort_by_msgid (mdlp); + /* Write the PO file. */ msgdomain_list_print (mdlp, file_name, output_syntax, textmode_xerror_handler, force_po, do_debug);