texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 17:24:18 -0400 (EDT)

branch: master
commit 1fed634e8c667bae4ac04bad4a8e0786a6497d44
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jul 12 09:34:48 2024 +0200

    * tp/Texinfo/Convert/HTML.pm (converter_initialize)
    (conversion_initialization): move setup of
    $self->{'translated_direction_strings'} based on defaults and user
    defined customization to converter_initialize.
---
 ChangeLog                  |  7 +++++
 tp/Texinfo/Convert/HTML.pm | 64 ++++++++++++++++++++++++++--------------------
 2 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 81b4df5733..364b40a25d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-07-12  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (converter_initialize)
+       (conversion_initialization): move setup of
+       $self->{'translated_direction_strings'} based on defaults and user
+       defined customization to converter_initialize.
+
 2024-07-12  Patrice Dumas  <pertusus@free.fr>
 
        * tp/t/input_files/command_non_break_spaces_koi8.texi,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f1b0d78c28..4b18ebe8a0 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9362,6 +9362,41 @@ sub converter_initialize($)
       = $customized_special_unit_body->{$special_unit_variety};
   }
 
+  # Fill the translated direction strings information, corresponding to:
+  #   - strings already converted
+  #   - strings not already converted
+  # Each of those types of translated strings are translated later on
+  # and the translated values are put in $self->{'direction_strings'}.
+  my $customized_direction_strings
+      = Texinfo::Config::GNUT_get_direction_string_info();
+  $self->{'translated_direction_strings'} = {};
+  foreach my $string_type (keys(%default_translated_directions_strings)) {
+    $self->{'translated_direction_strings'}->{$string_type} = {};
+    foreach my $direction
+           (keys(%{$default_translated_directions_strings{$string_type}})) {
+      if ($customized_direction_strings->{$string_type}
+            and $customized_direction_strings->{$string_type}->{$direction}) {
+        $self->{'translated_direction_strings'}->{$string_type}->{$direction}
+          = $customized_direction_strings->{$string_type}->{$direction};
+      } else {
+        if ($default_translated_directions_strings{$string_type}->{$direction}
+                                                              ->{'converted'}) 
{
+          $self->{'translated_direction_strings'}->{$string_type}
+                  ->{$direction} = {'converted' => {}};
+          foreach my $context ('normal', 'string') {
+            $self->{'translated_direction_strings'}->{$string_type}
+                     ->{$direction}->{'converted'}->{$context}
+               = $default_translated_directions_strings{$string_type}
+                                                 ->{$direction}->{'converted'};
+          }
+        } else {
+          $self->{'translated_direction_strings'}->{$string_type}->{$direction}
+            = 
$default_translated_directions_strings{$string_type}->{$direction};
+        }
+      }
+    }
+  }
+
   $self->{'stage_handlers'} = Texinfo::Config::GNUT_get_stage_handlers();
 
   # NOTE we reset silently if the split specification is not one known.
@@ -12355,6 +12390,7 @@ sub conversion_initialization($;$)
   #   - strings not already converted
   $self->{'directions_strings'} = {};
 
+  # The strings not translated, already converted are
   # initialized here and not with the converter because
   # substitute_html_non_breaking_space is used and it depends on the document.
   my $customized_direction_strings
@@ -12396,34 +12432,6 @@ sub conversion_initialization($;$)
     }
   }
 
-  $self->{'translated_direction_strings'} = {};
-  foreach my $string_type (keys(%default_translated_directions_strings)) {
-    $self->{'translated_direction_strings'}->{$string_type} = {};
-    foreach my $direction
-           (keys(%{$default_translated_directions_strings{$string_type}})) {
-      if ($customized_direction_strings->{$string_type}
-            and $customized_direction_strings->{$string_type}->{$direction}) {
-        $self->{'translated_direction_strings'}->{$string_type}->{$direction}
-          = $customized_direction_strings->{$string_type}->{$direction};
-      } else {
-        if ($default_translated_directions_strings{$string_type}->{$direction}
-                                                              ->{'converted'}) 
{
-          $self->{'translated_direction_strings'}->{$string_type}
-                  ->{$direction} = {'converted' => {}};
-          foreach my $context ('normal', 'string') {
-            $self->{'translated_direction_strings'}->{$string_type}
-                     ->{$direction}->{'converted'}->{$context}
-               = $default_translated_directions_strings{$string_type}
-                                                 ->{$direction}->{'converted'};
-          }
-        } else {
-          $self->{'translated_direction_strings'}->{$string_type}->{$direction}
-            = 
$default_translated_directions_strings{$string_type}->{$direction};
-        }
-      }
-    }
-  }
-
   $self->{'shared_conversion_state'} = {};
 
   $self->_initialize_output_state('_convert');



reply via email to

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