From: Bruno Haible Date: Wed, 28 Jan 2026 22:51:50 +0000 (+0100) Subject: msginit: Fix handling of --properties-output when producing a merged PO file. X-Git-Tag: v1.0~5 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f809e91cc9f6804332b2f1a91a41392d71fa5e4c;p=thirdparty%2Fgettext.git msginit: Fix handling of --properties-output when producing a merged PO file. * gettext-tools/src/msgl-merge.h (merge): Add definitions_file_syntax parameter. Rename input_syntax parameter to references_file_syntax. * gettext-tools/src/msgl-merge.c (merge): Likewise. * gettext-tools/src/msginit.c (main): New variable output_file_input_syntax. Fix merge() call. * gettext-tools/src/msgmerge.c (main): Update merge() call. --- diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index 4572e352d..16a1729b3 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -144,6 +144,7 @@ main (int argc, char **argv) char *output_file = NULL; const char *input_file = NULL; catalog_input_format_ty input_syntax = &input_format_po; + catalog_input_format_ty output_file_input_syntax = &input_format_po; catalog_output_format_ty output_syntax = &output_format_po; locale = NULL; @@ -198,6 +199,7 @@ main (int argc, char **argv) break; case 'p': + output_file_input_syntax = &input_format_properties; output_syntax = &output_format_properties; break; @@ -231,6 +233,7 @@ main (int argc, char **argv) break; case CHAR_MAX + 4: /* --stringtable-output */ + output_file_input_syntax = &input_format_stringtable; output_syntax = &output_format_stringtable; break; @@ -334,7 +337,9 @@ This is necessary so you can test your translations.\n"), quiet = true; keep_previous = true; msgdomain_list_ty *def; - result = merge (output_file, input_file, input_syntax, &def); + result = merge (output_file, output_file_input_syntax, + input_file, input_syntax, + &def); /* Update the header entry. */ result = fill_header (result, false); diff --git a/gettext-tools/src/msgl-merge.c b/gettext-tools/src/msgl-merge.c index 894cb6c34..16dc57852 100644 --- a/gettext-tools/src/msgl-merge.c +++ b/gettext-tools/src/msgl-merge.c @@ -1070,19 +1070,23 @@ match_domain (const char *definitions_file_name, } msgdomain_list_ty * -merge (const char *definitions_file_name, const char *references_file_name, - catalog_input_format_ty input_syntax, +merge (const char *definitions_file_name, + catalog_input_format_ty definitions_file_syntax, + const char *references_file_name, + catalog_input_format_ty references_file_syntax, msgdomain_list_ty **defp) { struct statistics stats; stats.merged = stats.fuzzied = stats.missing = stats.obsolete = 0; /* This is the definitions file, created by a human. */ - msgdomain_list_ty *def = read_catalog_file (definitions_file_name, input_syntax); + msgdomain_list_ty *def = + read_catalog_file (definitions_file_name, definitions_file_syntax); /* This is the references file, created by groping the sources with the xgettext program. */ - msgdomain_list_ty *ref = read_catalog_file (references_file_name, input_syntax); + msgdomain_list_ty *ref = + read_catalog_file (references_file_name, references_file_syntax); check_pot_charset (ref, references_file_name); /* Add a dummy header entry, if the references file contains none. */ for (size_t k = 0; k < ref->nitems; k++) diff --git a/gettext-tools/src/msgl-merge.h b/gettext-tools/src/msgl-merge.h index 566fca7ab..53d8562d6 100644 --- a/gettext-tools/src/msgl-merge.h +++ b/gettext-tools/src/msgl-merge.h @@ -1,5 +1,5 @@ /* Merging a .po file with a .pot file. - Copyright (C) 1995-2025 Free Software Foundation, Inc. + Copyright (C) 1995-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,8 +64,9 @@ extern string_list_ty *compendium_filenames; extern msgdomain_list_ty * merge (const char *definitions_file_name, + catalog_input_format_ty definitions_file_syntax, const char *references_file_name, - catalog_input_format_ty input_syntax, + catalog_input_format_ty references_file_syntax, msgdomain_list_ty **defp); diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c index 6c9296865..af3f3a116 100644 --- a/gettext-tools/src/msgmerge.c +++ b/gettext-tools/src/msgmerge.c @@ -408,7 +408,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\ /* Merge the two files. */ msgdomain_list_ty *def; msgdomain_list_ty *result = - merge (argv[optind], argv[optind + 1], input_syntax, &def); + merge (argv[optind], input_syntax, argv[optind + 1], input_syntax, &def); /* Sort the results. */ if (sort_by_filepos)