texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Patrice Dumas
Date: Fri, 2 Feb 2024 13:06:13 -0500 (EST)

branch: master
commit 06a2e2555d1dbfacd4cbcfcef152cf6317bf7139
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 2 19:06:02 2024 +0100

    * tp/Texinfo/XS/main/convert_utils.c (cdt_tree): add to replace
    gdt_tree when only converter is used.  Update caller of gdt_tree.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_translate_string),
    tp/Texinfo/XS/main/translations.c (translate_string): change order of
    arguments.  Use passed lang as is.  Update callers.
    
    * tp/Texinfo/XS/main/translations.c (gdt, gdt_tree, gdt_string)
    (pgdt_tree), tp/Texinfo/XS/main/DocumentXS.xs: change arguments order.
    Update callers.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_cdt, html_cdt_tree)
    (html_cdt_string, html_pcdt_tree): use instead of html_gdt,
    html_gdt_tree and html_gdt_string and html_pgdt_tree.  Determine lang
    from converter in html_cdt_tree and html_cdt_string, use converter
    document.  Update callers.
    
    * tp/Texinfo/XS/structuring_transfo/structuring.c (new_master_menu):
    separate better cases of options defined or not.
---
 ChangeLog                                       |  22 ++
 tp/Texinfo/XS/convert/convert_html.c            | 327 ++++++++++++------------
 tp/Texinfo/XS/convert/converter.c               |  36 ++-
 tp/Texinfo/XS/main/DocumentXS.xs                |  14 +-
 tp/Texinfo/XS/main/convert_to_text.c            |   7 +-
 tp/Texinfo/XS/main/convert_utils.c              |  32 ++-
 tp/Texinfo/XS/main/convert_utils.h              |   5 +
 tp/Texinfo/XS/main/translations.c               |  47 ++--
 tp/Texinfo/XS/main/translations.h               |  20 +-
 tp/Texinfo/XS/parsetexi/indices.c               |   6 +-
 tp/Texinfo/XS/structuring_transfo/structuring.c |  35 ++-
 11 files changed, 297 insertions(+), 254 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4de4bf94ca..27bcb2ef4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2024-02-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/convert_utils.c (cdt_tree): add to replace
+       gdt_tree when only converter is used.  Update caller of gdt_tree.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_translate_string),
+       tp/Texinfo/XS/main/translations.c (translate_string): change order of
+       arguments.  Use passed lang as is.  Update callers.
+
+       * tp/Texinfo/XS/main/translations.c (gdt, gdt_tree, gdt_string)
+       (pgdt_tree), tp/Texinfo/XS/main/DocumentXS.xs: change arguments order.
+       Update callers.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_cdt, html_cdt_tree)
+       (html_cdt_string, html_pcdt_tree): use instead of html_gdt,
+       html_gdt_tree and html_gdt_string and html_pgdt_tree.  Determine lang
+       from converter in html_cdt_tree and html_cdt_string, use converter
+       document.  Update callers.
+
+       * tp/Texinfo/XS/structuring_transfo/structuring.c (new_master_menu):
+       separate better cases of options defined or not.
+
 2024-02-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Translations.pm (pgdt): call gdt directly.
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 21c3d5710c..02b0749881 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -568,7 +568,8 @@ format_translate_message (CONVERTER *self,
 
 char *
 html_translate_string (CONVERTER *self, const char *string,
-                   const char *translation_context, const char *in_lang)
+                       const char *lang,
+                       const char *translation_context)
 {
   FORMATTING_REFERENCE *formatting_reference
     = &self->formatting_references[FR_format_translate_message];
@@ -579,52 +580,51 @@ html_translate_string (CONVERTER *self, const char 
*string,
       && formatting_reference->status != FRS_status_ignored
       && formatting_reference->sv_reference)
     {
-      const char *lang = in_lang;
-      char *translated_string;
-
-      if (!lang && self->conf->documentlanguage.string)
-        lang = self->conf->documentlanguage.string;
-
-      translated_string
+      char *translated_string
        = format_translate_message(self, string, lang, translation_context);
 
       if (translated_string)
         return translated_string;
     }
 
-  return translate_string (self->conf, string, translation_context,
-                           in_lang);
+  return translate_string (self->conf, string, lang, translation_context);
 }
 
 /* returns a document descriptor. */
 int
-html_gdt (const char *string, CONVERTER *self,
+html_cdt (const char *string, CONVERTER *self, const char *lang,
      NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-     const char *translation_context, const char *in_lang)
+     const char *translation_context)
 {
-  char *translated_string = html_translate_string (self, string,
-                                              translation_context,
-                                              in_lang);
+  char *translated_string;
+  int document_descriptor;
 
-  int document_descriptor
+  translated_string = html_translate_string (self, string, lang,
+                                              translation_context);
+  document_descriptor
     = replace_convert_substrings (self->conf, translated_string,
                                   replaced_substrings);
   free (translated_string);
   return document_descriptor;
 }
 
-/* a copy and paste of translations.c gdt_tree with html_gdt instead of gdt */
+/* a copy and paste of cdt_tree with html_cdt instead of cdt */
 ELEMENT *
-html_gdt_tree (const char *string, DOCUMENT *document, CONVERTER *self,
+html_cdt_tree (const char *string, CONVERTER *self,
                NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-               const char *translation_context,
-               const char *in_lang)
+               const char *translation_context)
 {
   ELEMENT *tree;
-  int gdt_document_descriptor = html_gdt (string, self, replaced_substrings,
-                                     translation_context, in_lang);
+  int cdt_document_descriptor;
+  const char *lang = 0;
+
+  if (self->conf->documentlanguage.string)
+    lang = self->conf->documentlanguage.string;
+
+  cdt_document_descriptor = html_cdt (string, self, lang, replaced_substrings,
+                                     translation_context);
   TREE_AND_STRINGS *tree_and_strings
-     = unregister_document_descriptor_tree (gdt_document_descriptor);
+     = unregister_document_descriptor_tree (cdt_document_descriptor);
 
   tree = tree_and_strings->tree;
 
@@ -634,11 +634,11 @@ html_gdt_tree (const char *string, DOCUMENT *document, 
CONVERTER *self,
          macro names, while we are parsing a simple string */
       if (tree_and_strings->small_strings->number)
         {
-          if (document)
-            merge_strings (document->small_strings,
+          if (self->document)
+            merge_strings (self->document->small_strings,
                            tree_and_strings->small_strings);
           else
-            fatal ("html_gdt_tree no document but small_strings");
+            fatal ("html_cdt_tree no document but small_strings");
         }
       free (tree_and_strings->small_strings->list);
       free (tree_and_strings->small_strings);
@@ -649,37 +649,43 @@ html_gdt_tree (const char *string, DOCUMENT *document, 
CONVERTER *self,
 }
 
 char *
-html_gdt_string (const char *string, CONVERTER *self,
+html_cdt_string (const char *string, CONVERTER *self,
                  NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                 const char *translation_context, const char *in_lang)
+                 const char *translation_context)
 {
-  char *translated_string = html_translate_string (self, string,
-                                      translation_context, in_lang);
+  char *translated_string;
+  char *result;
+  const char *lang = 0;
+
+  if (self->conf->documentlanguage.string)
+    lang = self->conf->documentlanguage.string;
+
+  translated_string = html_translate_string (self, string, lang,
+                                                   translation_context);
 
-  char *result = replace_substrings (translated_string, replaced_substrings);
+  result = replace_substrings (translated_string, replaced_substrings);
   free (translated_string);
   return result;
 }
 
 ELEMENT *
-html_pgdt_tree (const char *translation_context, const char *string,
-                DOCUMENT *document, CONVERTER *self,
-                NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                const char *in_lang)
+html_pcdt_tree (const char *translation_context, const char *string,
+                CONVERTER *self,
+                NAMED_STRING_ELEMENT_LIST *replaced_substrings)
 {
-  return html_gdt_tree (string, document, self, replaced_substrings,
-                        translation_context, in_lang);
+  return html_cdt_tree (string, self, replaced_substrings,
+                        translation_context);
 }
 
 static void
-translate_convert_to_html_internal (const char *string, DOCUMENT *document,
+translate_convert_to_html_internal (const char *string,
                CONVERTER *self,
                NAMED_STRING_ELEMENT_LIST *replaced_substrings,
                const char *translation_context,
-               const char *in_lang, TEXT *result, char *explanation)
+               TEXT *result, char *explanation)
 {
-  ELEMENT *translation_tree = html_gdt_tree (string, document, self,
-                           replaced_substrings, translation_context, in_lang);
+  ELEMENT *translation_tree = html_cdt_tree (string, self,
+                           replaced_substrings, translation_context);
 
   add_to_element_list (&self->tree_to_build, translation_tree);
   convert_to_html_internal (self, translation_tree, result, explanation);
@@ -1022,8 +1028,8 @@ special_unit_info_tree (CONVERTER *self, const enum 
special_unit_info_tree type,
           xasprintf (&translation_context, "%s section heading",
                      special_unit_variety);
           self->special_unit_info_tree[type][i]
-            = html_pgdt_tree (translation_context, special_unit_info_string,
-                              self->document, self, 0, 0);
+            = html_pcdt_tree (translation_context, special_unit_info_string,
+                              self, 0);
           free (translation_context);
           add_to_element_list (&self->tree_to_build,
                                self->special_unit_info_tree[type][i]);
@@ -2892,9 +2898,9 @@ direction_string (CONVERTER *self, int direction,
           text_append_n (&translation_context, " direction ", 11);
           text_append (&translation_context,
                        direction_type_translation_context[string_type]);
-          translated_tree = html_pgdt_tree (translation_context.text,
-                              dir_translated->to_convert, self->document,
-                              self, 0, 0);
+          translated_tree = html_pcdt_tree (translation_context.text,
+                              dir_translated->to_convert,
+                              self, 0);
           free (translation_context.text);
           if (context == TDS_context_string)
             {
@@ -2934,7 +2940,7 @@ direction_string (CONVERTER *self, int direction,
           if (context_converted_string)
             {
               char *translated_string
-                = html_gdt_string (context_converted_string, self, 0, 0, 0);
+                = html_cdt_string (context_converted_string, self, 0, 0);
               char *result_string
                 = substitute_html_non_breaking_space (self, translated_string);
               self->directions_strings[string_type][direction][context]
@@ -3832,16 +3838,15 @@ html_internal_command_tree (CONVERTER *self, const 
ELEMENT *command,
                       if (section_level == 1)
                         {
                           tree->tree
-                            = gdt_tree ("Appendix {number} {section_title}",
-                                        self->document, self->conf,
-                                        replaced_substrings, 0, 0);
+                            = html_cdt_tree (
+                                        "Appendix {number} {section_title}",
+                                        self, replaced_substrings, 0);
                         }
                     }
                   if (!tree->tree)
                     /* TRANSLATORS: numbered section title */
-                    tree->tree = gdt_tree ("{number} {section_title}",
-                                            self->document, self->conf,
-                                            replaced_substrings, 0, 0);
+                    tree->tree = html_cdt_tree ("{number} {section_title}",
+                                             self, replaced_substrings, 0);
 
                   destroy_named_string_element_list (replaced_substrings);
                   tree->status = tree_added_status_new_tree;
@@ -6540,9 +6545,9 @@ html_default_format_program_string (CONVERTER *self, TEXT 
*result)
       add_element_to_named_string_element_list (substrings,
                                                 "program", program);
 
-      tree = html_gdt_tree ("This document was generated on @emph{@today{}} "
+      tree = html_cdt_tree ("This document was generated on @emph{@today{}} "
                             "using @uref{{program_homepage}, 
@emph{{program}}}.",
-                            self->document, self, substrings, 0, 0);
+                            self, substrings, 0);
       destroy_named_string_element_list (substrings);
       /* destroyed with the tree
       destroy_element (program);
@@ -6551,8 +6556,8 @@ html_default_format_program_string (CONVERTER *self, TEXT 
*result)
     }
   else
     {
-      tree = html_gdt_tree ("This document was generated on @emph{@today{}}.",
-                            self->document, self, 0, 0, 0);
+      tree = html_cdt_tree ("This document was generated on @emph{@today{}}.",
+                            self, 0, 0);
     }
   add_to_element_list (&self->tree_to_build, tree);
   convert_to_html_internal (self, tree, result, 0);
@@ -6654,9 +6659,8 @@ html_default_format_end_file (CONVERTER *self, const char 
*filename,
               free (js_path);
               text_append_n (&result, "\" rel=\"jslicense\"><small>", 25);
 
-              tree = html_gdt_tree ("JavaScript license information",
-                                     self->document,
-                                     self, 0, 0, 0);
+              tree = html_cdt_tree ("JavaScript license information",
+                                     self, 0, 0);
               add_to_element_list (&self->tree_to_build, tree);
               convert_to_html_internal (self, tree, &result, 0);
               remove_element_from_list (&self->tree_to_build, tree);
@@ -6908,8 +6912,8 @@ file_header_information (CONVERTER *self, const ELEMENT 
*command,
 
           /* TRANSLATORS: sectioning element title for the page header */
           title_tree
-            = html_gdt_tree ("{element_text} ({title})",
-                             self->document, self, substrings, 0, 0);
+            = html_cdt_tree ("{element_text} ({title})",
+                             self, substrings, 0);
 
           destroy_named_string_element_list (substrings);
 
@@ -8174,8 +8178,8 @@ html_default_format_node_redirection_page (CONVERTER 
*self,
 
   text_init (&body);
   translate_convert_to_html_internal (
-          "The node you are looking for is at {href}.", self->document,
-           self, substrings, 0, 0, &body, 0);
+          "The node you are looking for is at {href}.",
+           self, substrings, 0, &body, 0);
 
   begin_info = file_header_information (self, element, filename);
 
@@ -8527,8 +8531,8 @@ convert_value_command (CONVERTER *self, const enum 
command_id cmd,
   add_element_to_named_string_element_list (substrings,
                                             "value", value_text);
 
-  tree = html_gdt_tree ("@{No value for `{value}'@}", self->document,
-                        self, substrings, 0, 0);
+  tree = html_cdt_tree ("@{No value for `{value}'@}",
+                        self, substrings, 0);
 
   add_to_element_list (&self->tree_to_build, tree);
   convert_to_html_internal (self, tree, result, 0);
@@ -8753,8 +8757,8 @@ convert_explained_command (CONVERTER *self, const enum 
command_id cmd,
                           "explained_string", explained_string_element);
       add_element_to_named_string_element_list (substrings,
                           "explanation", explanation_result_element);
-      tree = html_gdt_tree ("{explained_string} ({explanation})",
-                             self->document, self, substrings, 0, 0);
+      tree = html_cdt_tree ("{explained_string} ({explanation})",
+                             self, substrings, 0);
       destroy_named_string_element_list (substrings);
 
       xasprintf (&context_str, "convert explained  %s",
@@ -11274,8 +11278,8 @@ convert_quotation_command (CONVERTER *self, const enum 
command_id cmd,
 
               /* TRANSLATORS: quotation author */
               translate_convert_to_html_internal (
-                             "@center --- @emph{{author}}", self->document,
-                             self, substrings, 0, 0, result,
+                             "@center --- @emph{{author}}",
+                             self, substrings, 0, result,
                              "convert quotation author");
               destroy_named_string_element_list (substrings);
             }
@@ -12022,18 +12026,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                           "reference_name", reference_element);
       if (cmd == CM_pxref)
         {
-          tree = html_gdt_tree ("see {reference_name}", self->document,
-                                self, substrings, 0, 0);
+          tree = html_cdt_tree ("see {reference_name}",
+                                self, substrings, 0);
         }
       else if (cmd == CM_xref)
         {
-          tree = html_gdt_tree ("See {reference_name}", self->document,
-                                self, substrings, 0, 0);
+          tree = html_cdt_tree ("See {reference_name}",
+                                self, substrings, 0);
         }
       else if (cmd == CM_ref || cmd == CM_link)
         {
-          tree = html_gdt_tree ("{reference_name}", self->document,
-                                self, substrings, 0, 0);
+          tree = html_cdt_tree ("{reference_name}",
+                                self, substrings, 0);
         }
       destroy_named_string_element_list (substrings);
     }
@@ -12184,18 +12188,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                          "reference", reference_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see {reference} in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see {reference} in @cite{{book}}",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref)
             {
-              tree = html_gdt_tree ("See {reference} in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See {reference} in @cite{{book}}",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("{reference} in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("{reference} in @cite{{book}}",
+                                    self, substrings, 0);
             }
         }
       else if (book_reference)
@@ -12207,18 +12211,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                           "book_reference", book_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see @cite{{book_reference}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see @cite{{book_reference}}",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref || cmd == CM_inforef)
             {
-              tree = html_gdt_tree ("See @cite{{book_reference}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See @cite{{book_reference}}",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("@cite{{book_reference}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("@cite{{book_reference}}",
+                                    self, substrings, 0);
             }
         }
       else if (book && name)
@@ -12234,18 +12238,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                          "section", reference_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see `{section}' in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see `{section}' in @cite{{book}}",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref || cmd == CM_inforef)
             {
-              tree = html_gdt_tree ("See `{section}' in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See `{section}' in @cite{{book}}",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("`{section}' in @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("`{section}' in @cite{{book}}",
+                                    self, substrings, 0);
             }
         }
       else if (book)
@@ -12257,18 +12261,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                           "book", book_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see @cite{{book}}",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref || cmd == CM_inforef)
             {
-              tree = html_gdt_tree ("See @cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See @cite{{book}}",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("@cite{{book}}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("@cite{{book}}",
+                                    self, substrings, 0);
             }
         }
       else if (reference)
@@ -12280,18 +12284,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                          "reference", reference_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see {reference}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see {reference}",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref || cmd == CM_inforef)
             {
-              tree = html_gdt_tree ("See {reference}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See {reference}",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("{reference}",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("{reference}",
+                                    self, substrings, 0);
             }
         }
       else if (name)
@@ -12303,18 +12307,18 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
                                          "section", reference_element);
           if (cmd == CM_pxref)
             {
-              tree = html_gdt_tree ("see `{section}'",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("see `{section}'",
+                                    self, substrings, 0);
             }
           else if (cmd == CM_xref || cmd == CM_inforef)
             {
-              tree = html_gdt_tree ("See `{section}'",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("See `{section}'",
+                                    self, substrings, 0);
             }
           else /* @ref */
             {
-              tree = html_gdt_tree ("`{section}'",
-                                    self->document, self, substrings, 0, 0);
+              tree = html_cdt_tree ("`{section}'",
+                                    self, substrings, 0);
             }
         }
       free (reference);
@@ -12381,8 +12385,7 @@ printindex_letters_head_foot_internal (CONVERTER *self, 
const char *index_name,
   text_append_n (result, "><tr><th>", 9);
 
   /* TRANSLATORS: before list of letters and symbols grouping index entries */
-  translate_convert_to_html_internal ("Jump to", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Jump to", self, 0, 0, result, 0);
   text_append_n (result, ": ", 2);
   text_append_n (result,
                  self->special_character[SC_non_breaking_space].string,
@@ -12811,17 +12814,17 @@ convert_printindex_command (CONVERTER *self, const 
enum command_id cmd,
                     {
        /* TRANSLATORS: redirect to another index entry */
        /* TRANSLATORS: @: is discardable and is used to avoid a msgfmt error */
-                      result_tree = html_gdt_tree (
+                      result_tree = html_cdt_tree (
        "@code{{main_index_entry}}, @emph{See@:} @code{{seeentry}}",
-                                      self->document, self, substrings, 0, 0);
+                                      self, substrings, 0);
                     }
                   else
                     {
         /* TRANSLATORS: redirect to another index entry */
         /* TRANSLATORS: @: is discardable and used to avoid a msgfmt error */
-                      result_tree = html_gdt_tree (
+                      result_tree = html_cdt_tree (
                     "{main_index_entry}, @emph{See@:} {seeentry}",
-                                      self->document, self, substrings, 0, 0);
+                                      self, substrings, 0);
                     }
                   xasprintf (&convert_info,
                              "index %s l %s index entry %zu seeentry",
@@ -12854,9 +12857,9 @@ convert_printindex_command (CONVERTER *self, const enum 
command_id cmd,
 
                   add_element_to_named_string_element_list (substrings,
                                              "see_also_entry", referred_tree);
-                  reference_tree = html_gdt_tree (
+                  reference_tree = html_cdt_tree (
                                   "@emph{See also} {see_also_entry}",
-                                      self->document, self, substrings, 0, 0);
+                                      self, substrings, 0);
 
                   xasprintf (&conv_str_entry,
                              "index %s l %s index entry %zu (with seealso)",
@@ -13307,8 +13310,7 @@ convert_printindex_command (CONVERTER *self, const enum 
command_id cmd,
   free (attribute_class);
   text_append_n (result, ">", 1);
   /* TRANSLATORS: index entries column header in index formatting */
-  translate_convert_to_html_internal ("Index Entry", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Index Entry", self, 0, 0, result, 0);
   text_append_n (result, "</th>", 5);
 
   xasprintf (&index_name_cmd_class, "sections-header-%s",
@@ -13321,8 +13323,7 @@ convert_printindex_command (CONVERTER *self, const enum 
command_id cmd,
   free (attribute_class);
   text_append_n (result, ">", 1);
   /* TRANSLATORS: section of index entry column header in index formatting */
-  translate_convert_to_html_internal ("Section", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Section", self, 0, 0, result, 0);
   text_append_n (result, "</th></tr>\n", 11);
   text_append_n (result, "<tr><td colspan=\"3\">", 20);
   text_append (result, self->conf->DEFAULT_RULE.string);
@@ -13597,8 +13598,8 @@ open_quotation_command (CONVERTER *self, const enum 
command_id cmd,
       ELEMENT *quotation_arg_copy = copy_tree (element->args.list[0]);
       add_element_to_named_string_element_list (substrings,
                           "quotation_arg", quotation_arg_copy);
-      tree = html_gdt_tree ("@b{{quotation_arg}:} ", self->document,
-                           self, substrings, 0, 0);
+      tree = html_cdt_tree ("@b{{quotation_arg}:} ",
+                           self, substrings, 0);
       destroy_named_string_element_list (substrings);
       xasprintf (&explanation, "open %s prepended arg", cmdname);
       add_to_element_list (&self->tree_to_build, tree);
@@ -14855,20 +14856,20 @@ convert_def_line_type (CONVERTER *self, const enum 
element_type type,
               && !strcmp (self->conf->deftypefnnewline.string, "on"))
             {
                category_tree
-                  = html_gdt_tree ("{category} on @code{{class}}:@* ",
-                                   self->document, self, substrings, 0, 0);
+                  = html_cdt_tree ("{category} on @code{{class}}:@* ",
+                                   self, substrings, 0);
             }
           else if (base_cmd == CM_defop || base_cmd == CM_deftypeop)
             {
                category_tree
-                  = html_gdt_tree ("{category} on @code{{class}}: ",
-                                   self->document, self, substrings, 0, 0);
+                  = html_cdt_tree ("{category} on @code{{class}}: ",
+                                   self, substrings, 0);
             }
           else if (base_cmd == CM_defcv || base_cmd == CM_deftypecv)
             {
                category_tree
-                  = html_gdt_tree ("{category} of @code{{class}}: ",
-                                   self->document, self, substrings, 0, 0);
+                  = html_cdt_tree ("{category} of @code{{class}}: ",
+                                   self, substrings, 0);
             }
         }
       else
@@ -14878,14 +14879,14 @@ convert_def_line_type (CONVERTER *self, const enum 
element_type type,
               && !strcmp (self->conf->deftypefnnewline.string, "on"))
             {
               category_tree
-                  = html_gdt_tree ("{category}:@* ",
-                                   self->document, self, substrings, 0, 0);
+                  = html_cdt_tree ("{category}:@* ",
+                                   self, substrings, 0);
             }
           else
             {
               category_tree
-                  = html_gdt_tree ("{category}: ",
-                                   self->document, self, substrings, 0, 0);
+                  = html_cdt_tree ("{category}: ",
+                                   self, substrings, 0);
             }
         }
       destroy_named_string_element_list (substrings);
@@ -15384,19 +15385,16 @@ default_format_special_body_about (CONVERTER *self,
   text_append_n (result, "<p>\n", 4);
   translate_convert_to_html_internal (
    "  The buttons in the navigation panels have the following meaning:",
-   self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "\n</p>\n<table border=\"1\">\n  <tr>\n    <th> ");
-  translate_convert_to_html_internal ("Button", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Button", self, 0, 0, result, 0);
   text_append (result, " </th>\n    <th> ");
-  translate_convert_to_html_internal ("Name", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Name", self, 0, 0, result, 0);
   text_append (result, " </th>\n    <th> ");
-  translate_convert_to_html_internal ("Go to", self->document, self, 0,
-                                      0, 0, result, 0);
+  translate_convert_to_html_internal ("Go to", self, 0, 0, result, 0);
   text_append (result, " </th>\n    <th> ");
-  translate_convert_to_html_internal ("From 1.2.3 go to", self->document,
-                                      self, 0, 0, 0, result, 0);
+  translate_convert_to_html_internal ("From 1.2.3 go to", self, 0, 0,
+                                      result, 0);
   text_append (result, "</th>\n  </tr>\n");
 
   for (i = 0; i < buttons->number; i++)
@@ -15469,28 +15467,28 @@ default_format_special_body_about (CONVERTER *self,
   translate_convert_to_html_internal (
  "  where the @strong{ Example } assumes that the current position is at "
  "@strong{ Subsubsection One-Two-Three } of a document of the following "
- "structure:", self->document, self, 0, 0, 0, result, 0);
+ "structure:", self, 0, 0, result, 0);
 
   text_append_n (result, "\n</p>\n\n<ul>\n", 12);
   text_append (result, "  <li> 1. ");
   translate_convert_to_html_internal ("Section One",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "\n    <ul>\n      <li>1.1 ");
   translate_convert_to_html_internal ("Subsection One-One",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "\n        <ul>\n          <li>...</li>\n"
      "        </ul>\n      </li>\n      <li>1.2 ");
   translate_convert_to_html_internal ("Subsection One-Two",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "\n        <ul>\n          <li>1.2.1 ");
   translate_convert_to_html_internal ("Subsubsection One-Two-One",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "</li>\n          <li>1.2.2 ");
   translate_convert_to_html_internal ("Subsubsection One-Two-Two",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "</li>\n          <li>1.2.3 ");
   translate_convert_to_html_internal ("Subsubsection One-Two-Three",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append_n (result, " ", 1);
   text_append_n (result,
                 self->special_character[SC_non_breaking_space].string,
@@ -15503,17 +15501,17 @@ default_format_special_body_about (CONVERTER *self,
 
   text_append (result, "            <strong>&lt;== ");
   translate_convert_to_html_internal ("Current Position",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, " </strong></li>\n          <li>1.2.4 ");
   translate_convert_to_html_internal ("Subsubsection One-Two-Four",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "</li>\n        </ul>\n      </li>\n      <li>1.3 ");
   translate_convert_to_html_internal ("Subsection One-Three",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "\n        <ul>\n          <li>...</li>\n"
   "        </ul>\n      </li>\n      <li>1.4 ");
   translate_convert_to_html_internal ("Subsection One-Four",
-                           self->document, self, 0, 0, 0, result, 0);
+                                      self, 0, 0, result, 0);
   text_append (result, "</li>\n    </ul>\n  </li>\n</ul>\n");
 }
 
@@ -15678,8 +15676,8 @@ html_prepare_converted_output_info (CONVERTER *self)
 
   if (!html_title_string)
     {
-      ELEMENT *default_title = html_gdt_tree ("Untitled Document",
-                                         self->document, self, 0, 0, 0);
+      ELEMENT *default_title = html_cdt_tree ("Untitled Document",
+                                              self, 0, 0);
       SOURCE_INFO cmd_source_info;
 
       self->title_tree = default_title;
@@ -17130,8 +17128,8 @@ html_translate_names (CONVERTER *self)
                   add_cmd = 1;
                   free (format_spec->text);
                   format_spec->text
-                   = html_gdt_string (format_spec->translated_converted, self,
-                                 0, 0, 0);
+                   = html_cdt_string (format_spec->translated_converted, self,
+                                      0, 0);
                 }
               else if (cctx == HCC_type_normal)
                 {
@@ -17140,8 +17138,8 @@ html_translate_names (CONVERTER *self)
                     {/* it is very unlikely to have small strings to add,
                         but in case there are is should be ok */
                       translated_tree =
-                        html_gdt_tree (format_spec->translated_to_convert,
-                                       self->document, self, 0, 0, 0);
+                        html_cdt_tree (format_spec->translated_to_convert,
+                                       self, 0, 0);
                     }
                   else
                     translated_tree = translated_command_tree (self, cmd);
@@ -17564,9 +17562,8 @@ convert_to_html_internal (CONVERTER *self, const 
ELEMENT *element,
         {
           char *translation_context
             = lookup_extra_string (element, "translation_context");
-          ELEMENT *translated = html_gdt_tree (element->text.text,
-                                               self->document,
-                                           self, 0, translation_context, 0);
+          ELEMENT *translated = html_cdt_tree (element->text.text,
+                                           self, 0, translation_context);
 
           add_to_element_list (&self->tree_to_build, translated);
 
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index 52014cf255..3aaf9ba208 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -343,15 +343,13 @@ float_type_number (CONVERTER *self, const ELEMENT 
*float_e)
       add_element_to_named_string_element_list (replaced_substrings,
                                      "float_type", type_element_copy);
       if (float_number)
-        tree = gdt_tree ("{float_type} {float_number}", self->document,
-                         self->conf, replaced_substrings, 0, 0);
+        tree = cdt_tree ("{float_type} {float_number}", self,
+                         replaced_substrings, 0);
       else
-        tree = gdt_tree ("{float_type}", self->document, self->conf,
-                         replaced_substrings, 0, 0);
+        tree = cdt_tree ("{float_type}", self, replaced_substrings, 0);
     }
   else if (float_number)
-    tree = gdt_tree ("{float_number}", self->document, self->conf,
-                     replaced_substrings, 0, 0);
+    tree = cdt_tree ("{float_number}", self, replaced_substrings, 0);
 
   destroy_named_string_element_list (replaced_substrings);
 
@@ -395,34 +393,32 @@ float_name_caption (CONVERTER *self, const ELEMENT 
*float_e)
         {
           if (float_number)
             /* TRANSLATORS: added before caption */
-            prepended = gdt_tree ("{float_type} {float_number}: ",
-                                  self->document,
-                                  self->conf, replaced_substrings, 0, 0);
+            prepended = cdt_tree ("{float_type} {float_number}: ",
+                                  self, replaced_substrings, 0);
           else
             /* TRANSLATORS: added before caption, no float label */
-            prepended = gdt_tree ("{float_type}: ", self->document, self->conf,
-                                 replaced_substrings, 0, 0);
+            prepended = cdt_tree ("{float_type}: ", self,
+                                  replaced_substrings, 0);
         }
       else
         {
           if (float_number)
-            prepended = gdt_tree ("{float_type} {float_number}",
-                                  self->document,
-                                  self->conf, replaced_substrings, 0, 0);
+            prepended = cdt_tree ("{float_type} {float_number}",
+                                  self, replaced_substrings, 0);
           else
-            prepended = gdt_tree ("{float_type}", self->document, self->conf,
-                                 replaced_substrings, 0, 0);
+            prepended = cdt_tree ("{float_type}", self,
+                                  replaced_substrings, 0);
         }
     }
   else if (float_number)
     {
       if (caption_element)
       /* TRANSLATORS: added before caption, no float type */
-        prepended = gdt_tree ("{float_number}: ", self->document, self->conf,
-                              replaced_substrings, 0, 0);
+        prepended = cdt_tree ("{float_number}: ", self,
+                              replaced_substrings, 0);
       else
-        prepended = gdt_tree ("{float_number}", self->document, self->conf,
-                              replaced_substrings, 0, 0);
+        prepended = cdt_tree ("{float_number}", self,
+                              replaced_substrings, 0);
     }
 
   result->caption = caption_element;
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 4e8a766414..ef753f7071 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -191,7 +191,7 @@ set_document_options (SV *sv_options_in, SV *document_in)
 # the approach does not work because replaced_substrings
 # perl element tree cannot be retrieved in C stored documents.
 # optional:
-# replaced_substrings, translation_context, lang
+# lang, replaced_substrings, translation_context
 SV *
 gdt (SV *options_in, string, ...)
         char *string = (char *)SvPVutf8_nolen($arg);
@@ -210,16 +210,16 @@ gdt (SV *options_in, string, ...)
            {
              options = init_copy_sv_options (options_in, 0, 0);
            }
+        if (items > 2 && SvOK(ST(2)))
+           in_lang = (char *)SvPVutf8_nolen(ST(2));
         if (items > 4 && SvOK(ST(4)))
-           in_lang = (char *)SvPVutf8_nolen(ST(4));
+           translation_context = (char *)SvPVutf8_nolen(ST(4));
         if (items > 3 && SvOK(ST(3)))
-           translation_context = (char *)SvPVutf8_nolen(ST(3));
-        if (items > 2 && SvOK(ST(2)))
            {
              /* TODO put in get_perl_info.h */
              I32 hv_number;
              I32 i;
-             hv_replaced_substrings = (HV *)SvRV (ST(1));
+             hv_replaced_substrings = (HV *)SvRV (ST(3));
              hv_number = hv_iterinit (hv_replaced_substrings);
              if (hv_number > 0)
                replaced_substrings = new_named_string_element_list ();
@@ -241,8 +241,8 @@ gdt (SV *options_in, string, ...)
            }
 
          gdt_document_descriptor
-                     = gdt (string, options, replaced_substrings,
-                           translation_context, in_lang);
+                     = gdt (string, options, in_lang, replaced_substrings,
+                           translation_context);
          gdt_document = retrieve_document (gdt_document_descriptor);
          result_tree = build_texinfo_tree (gdt_document->tree, 0);
          hv_store (result_tree, "tree_document_descriptor",
diff --git a/tp/Texinfo/XS/main/convert_to_text.c 
b/tp/Texinfo/XS/main/convert_to_text.c
index c7f6b5de55..e099bb5df6 100644
--- a/tp/Texinfo/XS/main/convert_to_text.c
+++ b/tp/Texinfo/XS/main/convert_to_text.c
@@ -533,10 +533,9 @@ convert_to_text_internal (const ELEMENT *element, 
TEXT_OPTIONS *text_options,
         */
           char *translation_context
             = lookup_extra_string (element, "translation_context");
-          ELEMENT *tree = gdt_tree (element->text.text,
-                                    text_options->converter->document,
-                                    text_options->converter->conf, 0,
-                                    translation_context, 0);
+          ELEMENT *tree = cdt_tree (element->text.text,
+                                    text_options->converter,
+                                    0, translation_context);
           if (tree)
             {
               convert_to_text_internal (tree, text_options, result);
diff --git a/tp/Texinfo/XS/main/convert_utils.c 
b/tp/Texinfo/XS/main/convert_utils.c
index 3f505852fe..35a28a0303 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -92,7 +92,7 @@ expand_today (OPTIONS *options)
   year = time_tm->tm_year + 1900;
 
   month_tree = gdt_tree (convert_utils_month_name[time_tm->tm_mon], 0, options,
-                         0, 0, 0);
+                         options->documentlanguage.string, 0, 0);
   day_element = new_element (ET_NONE);
   year_element = new_element (ET_NONE);
   text_printf (&day_element->text, "%d", time_tm->tm_mday);
@@ -103,7 +103,8 @@ expand_today (OPTIONS *options)
   add_element_to_named_string_element_list (substrings, "day", day_element);
   add_element_to_named_string_element_list (substrings, "year", year_element);
 
-  result = gdt_tree ("{month} {day}, {year}", 0, options, substrings, 0, 0);
+  result = gdt_tree ("{month} {day}, {year}", 0, options,
+                     options->documentlanguage.string, substrings, 0);
   destroy_named_string_element_list (substrings);
 
   return result;
@@ -210,12 +211,14 @@ add_heading_number (OPTIONS *options, const ELEMENT 
*current, char *text,
                 {
                   numbered_heading
                    = gdt_string ("Appendix {number} {section_title}",
-                                 options, substrings, 0, 0);
+                                 options, options->documentlanguage.string,
+                                 substrings, 0);
                 }
             }
           if (!numbered_heading)
-            numbered_heading = gdt_string ("{number} {section_title}",
-                                          options, substrings, 0, 0);
+            numbered_heading
+              = gdt_string ("{number} {section_title}", options,
+                            options->documentlanguage.string, substrings, 0);
 
           destroy_named_string_element_list (substrings);
 
@@ -563,7 +566,7 @@ definition_category_tree (OPTIONS * options, const ELEMENT 
*current)
            */
 
           result = gdt_tree ("{category} on @code{{class}}", 0, options,
-                             substrings, 0, 0);
+                             options->documentlanguage.string, substrings, 0);
           destroy_named_string_element_list (substrings);
         }
       else
@@ -595,7 +598,7 @@ definition_category_tree (OPTIONS * options, const ELEMENT 
*current)
            */
 
           result = gdt_tree ("{category} of @code{{class}}", 0, options,
-                             substrings, 0, 0);
+                             options->documentlanguage.string, substrings, 0);
           destroy_named_string_element_list (substrings);
         }
       else
@@ -611,6 +614,17 @@ definition_category_tree (OPTIONS * options, const ELEMENT 
*current)
   return result;
 }
 
+ELEMENT *
+cdt_tree (const char * string, CONVERTER *self,
+          NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+          const char *translation_context)
+{
+  const char *lang = self->conf->documentlanguage.string;
+
+  return gdt_tree (string, self->document, self->conf, lang,
+                   replaced_substrings, translation_context);
+}
+
 ELEMENT *
 translated_command_tree (CONVERTER *self, enum command_id cmd)
 {
@@ -622,8 +636,8 @@ translated_command_tree (CONVERTER *self, enum command_id 
cmd)
       if (translated_command->cmd == cmd
           && translated_command->translation)
         {
-          ELEMENT *result = gdt_tree (translated_command->translation, 0,
-                                      self->conf, 0, 0, 0);
+          ELEMENT *result = cdt_tree (translated_command->translation,
+                                      self, 0, 0);
           return result;
         }
     }
diff --git a/tp/Texinfo/XS/main/convert_utils.h 
b/tp/Texinfo/XS/main/convert_utils.h
index e7f2773223..ff895c3bcf 100644
--- a/tp/Texinfo/XS/main/convert_utils.h
+++ b/tp/Texinfo/XS/main/convert_utils.h
@@ -8,6 +8,7 @@
 #include "tree_types.h"
 #include "document_types.h"
 #include "converter_types.h"
+#include "translations.h"
 
 extern char *convert_utils_month_name[12];
 
@@ -34,6 +35,10 @@ PARSED_DEF *definition_arguments_content (const ELEMENT 
*element);
 void destroy_parsed_def (PARSED_DEF *parsed_def);
 ELEMENT *definition_category_tree (OPTIONS *options, const ELEMENT *current);
 
+ELEMENT *cdt_tree (const char * string, CONVERTER *self,
+                   NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+                   const char *translation_context);
+
 ELEMENT *translated_command_tree (CONVERTER *self, enum command_id cmd);
 void destroy_translated_commands (TRANSLATED_COMMAND *translated_commands);
 
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index a36a275a4b..8f2a310807 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -149,8 +149,8 @@ switch_messages_locale (void)
 }
 
 char *
-translate_string (OPTIONS *options, const char * string,
-                  const char *translation_context, const char *in_lang)
+translate_string (OPTIONS *options, const char * string, const char *in_lang,
+                  const char *translation_context)
 {
   const char *lang = in_lang;
   char *saved_LANGUAGE;
@@ -163,9 +163,7 @@ translate_string (OPTIONS *options, const char * string,
   static TEXT language_locales;
   int i;
 
-  if ((!lang) && options && options->documentlanguage.string)
-    lang = options->documentlanguage.string;
-  if (!lang)
+  if (!in_lang)
     lang = "en";
 
   if (strlen (lang) == 0)
@@ -268,7 +266,8 @@ translate_string (OPTIONS *options, const char * string,
 
   if (setenv ("LANGUAGE", language_locales.text, 1) != 0)
     {
-      fprintf (stderr, "gdt: setenv `%s' error for string `%s': %s\n",
+      fprintf (stderr,
+              "translate_string: setenv `%s' error for string `%s': %s\n",
               language_locales.text, string, strerror(errno));
     }
 
@@ -523,13 +522,12 @@ replace_convert_substrings (OPTIONS *options, char 
*translated_string,
 
 /* returns a document descriptor. */
 int
-gdt (const char *string, OPTIONS *options,
+gdt (const char *string, OPTIONS *options, const char *lang,
      NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-     const char *translation_context, const char *in_lang)
+     const char *translation_context)
 {
-  char *translated_string = translate_string (options, string,
-                                              translation_context,
-                                              in_lang);
+  char *translated_string = translate_string (options, string, lang,
+                                              translation_context);
 
   int document_descriptor
     = replace_convert_substrings (options, translated_string,
@@ -544,13 +542,12 @@ gdt (const char *string, OPTIONS *options,
    if one knows that there won't be small strings (the general case) */
 ELEMENT *
 gdt_tree (const char *string, DOCUMENT *document, OPTIONS *options,
-          NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-          const char *translation_context,
-          const char *in_lang)
+          const char *lang, NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+          const char *translation_context)
 {
   ELEMENT *tree;
-  int gdt_document_descriptor = gdt (string, options, replaced_substrings,
-                                     translation_context, in_lang);
+  int gdt_document_descriptor = gdt (string, options, lang,
+                                     replaced_substrings, translation_context);
   TREE_AND_STRINGS *tree_and_strings
      = unregister_document_descriptor_tree (gdt_document_descriptor);
 
@@ -577,13 +574,12 @@ gdt_tree (const char *string, DOCUMENT *document, OPTIONS 
*options,
 }
 
 char *
-gdt_string (const char *string, OPTIONS *options,
+gdt_string (const char *string, OPTIONS *options, const char *lang,
             NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-            const char *translation_context, const char *in_lang)
+            const char *translation_context)
 {
-  char *translated_string = translate_string (options, string,
-                                              translation_context,
-                                              in_lang);
+  char *translated_string = translate_string (options, string, lang,
+                                              translation_context);
 
   char *result = replace_substrings (translated_string, replaced_substrings);
   free (translated_string);
@@ -592,12 +588,11 @@ gdt_string (const char *string, OPTIONS *options,
 
 ELEMENT *
 pgdt_tree (const char *translation_context, const char *string,
-           DOCUMENT *document, OPTIONS *options,
-           NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-           const char *in_lang)
+           DOCUMENT *document, OPTIONS *options, const char *lang,
+           NAMED_STRING_ELEMENT_LIST *replaced_substrings)
 {
-  return gdt_tree (string, document, options, replaced_substrings,
-                   translation_context, in_lang);
+  return gdt_tree (string, document, options, lang, replaced_substrings,
+                   translation_context);
 }
 
 NAMED_STRING_ELEMENT_LIST *
diff --git a/tp/Texinfo/XS/main/translations.h 
b/tp/Texinfo/XS/main/translations.h
index bc2a5a5f7c..1219def509 100644
--- a/tp/Texinfo/XS/main/translations.h
+++ b/tp/Texinfo/XS/main/translations.h
@@ -25,30 +25,30 @@ void configure_output_strings_translations (char 
*localesdir,
                                             char *strings_textdomain_in);
 
 char *translate_string (OPTIONS *options, const char * string,
-                  const char *translation_context, const char *in_lang);
+                        const char *lang,
+                        const char *translation_context);
 int replace_convert_substrings (OPTIONS *options, char *translated_string,
                             NAMED_STRING_ELEMENT_LIST *replaced_substrings);
 char *replace_substrings (const char *string,
                     const NAMED_STRING_ELEMENT_LIST *replaced_substrings);
 
-int gdt (const char * string, OPTIONS *options,
+int gdt (const char * string, OPTIONS *options, const char *lang,
          NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-         const char *translation_context,
-         const char *in_lang);
+         const char *translation_context);
 
 ELEMENT *gdt_tree (const char * string, DOCUMENT *document, OPTIONS *options,
+                   const char *lang,
                    NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                   const char *translation_context,
-                   const char *in_lang);
+                   const char *translation_context);
 
-char *gdt_string (const char *string, OPTIONS *options,
+char *gdt_string (const char *string, OPTIONS *options, const char *lang,
                   NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                  const char *translation_context, const char *in_lang);
+                  const char *translation_context);
 
 ELEMENT *pgdt_tree (const char *translation_context, const char *string,
                     DOCUMENT *document, OPTIONS *options,
-                    NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                    const char *in_lang);
+                    const char *lang,
+                    NAMED_STRING_ELEMENT_LIST *replaced_substrings);
 
 NAMED_STRING_ELEMENT_LIST * new_named_string_element_list (void);
 void add_string_to_named_string_element_list (NAMED_STRING_ELEMENT_LIST *nsel,
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index 49535401ff..e431704ff8 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -461,7 +461,7 @@ complete_indices (int document_descriptor)
                           to be set, but we use the language of the element */
                           index_entry = gdt_tree ("{name} on {class}",
                                                   document, options,
-                                                  substrings, 0, lang);
+                                                  lang, substrings, 0);
 
                           text_append (&text_element->text, " on ");
                         }
@@ -471,8 +471,8 @@ complete_indices (int document_descriptor)
                                || def_command == CM_deftypecv)
                         {
                           index_entry = gdt_tree ("{name} of {class}",
-                                                  document, options,
-                                                  substrings, 0, lang);
+                                                  document, options, lang,
+                                                  substrings, 0);
 
                           text_append (&text_element->text, " of ");
                         }
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c 
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index da5aeb9f0b..954f7bcf67 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -1967,26 +1967,41 @@ new_master_menu (OPTIONS *options, LABEL_LIST 
*identifiers_target,
   if (master_menu->contents.number > 0)
     {
       int i;
-      ELEMENT *master_menu_title;
       ELEMENT *new_line = new_element (ET_NONE);
     /* There is a menu comment with a preformatted added in front of each
        detailed menu section with the node section name */
       ELEMENT *first_preformatted
         = master_menu->contents.list[0]->contents.list[0];
-      master_menu_title
-          = gdt_tree (" --- The Detailed Node Listing ---", 0, options,
-                      0, 0, 0);
-
-      for (i = 0; i < master_menu_title->contents.number; i++)
-        master_menu_title->contents.list[i]->parent = first_preformatted;
 
       text_append (&new_line->text, "\n");
       new_line->parent = first_preformatted;
       insert_into_contents (first_preformatted, new_line, 0);
 
-      insert_slice_into_contents (first_preformatted, 0, master_menu_title, 0,
-                                  master_menu_title->contents.number);
-      destroy_element (master_menu_title);
+      if (options)
+        {
+          ELEMENT *master_menu_title;
+          master_menu_title
+            = gdt_tree (" --- The Detailed Node Listing ---", 0, options,
+                        options->documentlanguage.string, 0, 0);
+
+          for (i = 0; i < master_menu_title->contents.number; i++)
+            master_menu_title->contents.list[i]->parent = first_preformatted;
+
+          insert_slice_into_contents (first_preformatted, 0,
+                                      master_menu_title, 0,
+                                      master_menu_title->contents.number);
+          destroy_element (master_menu_title);
+        }
+      else
+        {
+          ELEMENT *master_menu_title_string = new_element (ET_NONE);
+          text_append (&master_menu_title_string->text,
+                       " --- The Detailed Node Listing ---");
+          master_menu_title_string->parent = first_preformatted;
+          insert_into_contents (first_preformatted,
+                                master_menu_title_string, 0);
+        }
+
 
       new_block_command (master_menu, CM_detailmenu);
       return master_menu;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]