texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Translations.pm (configure): warn if


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Translations.pm (configure): warn if $localesdir is undefined and do not call bindtextdomain nor _XS_configure in that case.
Date: Mon, 27 May 2024 04:29:47 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 7311c116ee * tp/Texinfo/Translations.pm (configure): warn if 
$localesdir is undefined and do not call bindtextdomain nor _XS_configure in 
that case.
7311c116ee is described below

commit 7311c116eee44d4b6f3836cb7b927cf71b04bb14
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 27 10:29:34 2024 +0200

    * tp/Texinfo/Translations.pm (configure): warn if $localesdir
    is undefined and do not call bindtextdomain nor _XS_configure
    in that case.
    
    * tp/t/same_parser_multiple_files.t: find $localesdir and call
    Texinfo::Translations::configure.
    
    * tp/t/test_utils.pl: add a comment to explain that even with
    LocaleData not found, the test could still succeed if the translations
    are found elsewhere.
---
 ChangeLog                            | 13 +++++++++++++
 tp/Texinfo/Translations.pm           | 10 +++++++---
 tp/Texinfo/XS/convert/convert_html.c |  2 +-
 tp/t/same_parser_multiple_files.t    | 20 ++++++++++++++++++++
 tp/t/test_utils.pl                   |  6 +++++-
 5 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71dda44fa4..58bb3208e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-05-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Translations.pm (configure): warn if $localesdir
+       is undefined and do not call bindtextdomain nor _XS_configure
+       in that case.
+
+       * tp/t/same_parser_multiple_files.t: find $localesdir and call
+       Texinfo::Translations::configure.
+
+       * tp/t/test_utils.pl: add a comment to explain that even with
+       LocaleData not found, the test could still succeed if the translations
+       are found elsewhere.
+
 2024-05-27  Patrice Dumas  <pertusus@free.fr>
 
        * doc/tp_api/texi2any_internals_preamble.texi: add @setfilename for
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index e3e0536994..fd34d45b8f 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -94,9 +94,13 @@ sub configure($;$)
   if (defined($in_strings_textdomain)) {
     $strings_textdomain = $in_strings_textdomain;
   }
-  Locale::Messages::bindtextdomain($strings_textdomain, $localesdir);
-  # set the directory for the XS code too
-  _XS_configure($localesdir, $strings_textdomain);
+  if (defined($localesdir)) {
+    Locale::Messages::bindtextdomain($strings_textdomain, $localesdir);
+    # set the directory for the XS code too
+    _XS_configure($localesdir, $strings_textdomain);
+  } else {
+    warn 'WARNING: string textdomain directory undefined'."\n";
+  }
 }
 
 # libintl converts between encodings but doesn't decode them into the
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 801d7952d1..c4e1cdc964 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -6024,7 +6024,7 @@ html_default_format_heading_text (CONVERTER *self, const 
enum command_id cmd,
     heading_level = 1;
   else
     {
-      /* TODO if option defaults become more used,
+      /* TODO if defaults of converter options become more used in C code,
          setup a structure with options defaults instead of hardcoding */
       int max_header_level = 4;
       if (self->conf->MAX_HEADER_LEVEL.integer >= 1)
diff --git a/tp/t/same_parser_multiple_files.t 
b/tp/t/same_parser_multiple_files.t
index 23602599c5..c6d5a74673 100644
--- a/tp/t/same_parser_multiple_files.t
+++ b/tp/t/same_parser_multiple_files.t
@@ -68,12 +68,32 @@ my $debug = 0;
 #my $debug = 1;
 
 my $srcdir = $ENV{'srcdir'};
+my $locales_srcdir;
 if (defined($srcdir)) {
   $srcdir =~ s/\/*$/\//;
+  $locales_srcdir = $srcdir;
 } else {
   $srcdir = '.';
+  $locales_srcdir = '.';
 }
 
+# NOTE if the LocaleData directory is not found, the test could still succeed
+# if the translations for the strings textdomain are found elsewhere in the
+# system.  If the translations found elsewhere are too old, some tests could
+# still fail.
+my $localesdir;
+foreach my $dir ("LocaleData", "$locales_srcdir/LocaleData") {
+  if (-d $dir) {
+    $localesdir = $dir;
+  }
+}
+
+if (! defined($localesdir)) {
+  warn "No locales directory found, some tests could fail\n";
+}
+
+Texinfo::Translations::configure($localesdir);
+
 my $test_group = 'same_parser_multiple_files';
 
 sub _run_test($$$)
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 3d68c8d6f8..53e4b50af6 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -103,6 +103,10 @@ if (defined($srcdir)) {
   $locales_srcdir = '.';
 }
 
+# NOTE if the LocaleData directory is not found, the test could still succeed
+# if the translations for the strings textdomain are found elsewhere in the
+# system.  If the translations found elsewhere are too old, some tests could
+# still fail.
 my $localesdir;
 foreach my $dir ("LocaleData", "$locales_srcdir/LocaleData") {
   if (-d $dir) {
@@ -111,7 +115,7 @@ foreach my $dir ("LocaleData", 
"$locales_srcdir/LocaleData") {
 }
 
 if (! defined($localesdir)) {
-  warn "No locales directory found, some tests will fail\n";
+  warn "No locales directory found, some tests could fail\n";
 }
 
 Texinfo::Translations::configure($localesdir);



reply via email to

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