]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msginit: Fix handling of --properties-output when producing a merged PO file.
authorBruno Haible <bruno@clisp.org>
Wed, 28 Jan 2026 22:51:50 +0000 (23:51 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 28 Jan 2026 23:36:19 +0000 (00:36 +0100)
* 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.

gettext-tools/src/msginit.c
gettext-tools/src/msgl-merge.c
gettext-tools/src/msgl-merge.h
gettext-tools/src/msgmerge.c

index 4572e352d72e2d81f6774021250b308d8a15f6d1..16a1729b38a3e1edbb80ddd5538d37eceb070e73 100644 (file)
@@ -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);
index 894cb6c34c8212af5a2ee2f8305c3dd8d476986a..16dc57852bae3793e5e2031e5b58aefced9cbd35 100644 (file)
@@ -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++)
index 566fca7abf501bc12997c06d8798a88fd9f66c18..53d8562d6ce8a3774465b45e3a221b2676cfee67 100644 (file)
@@ -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);
 
 
index 6c9296865cf28e6dbf60b818c4b090364b5a2332..af3f3a116457cb234e12bf95a08f5c4c5701210a 100644 (file)
@@ -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)