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 (translate_string),


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Translations.pm (translate_string), tp/Texinfo/XS/main/translations.c (translate_string): consider an empty string to be an unset value, and do the same checks in C and Perl.
Date: Fri, 18 Oct 2024 07:43:34 -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 3de072ae55 * tp/Texinfo/Translations.pm (translate_string), 
tp/Texinfo/XS/main/translations.c (translate_string): consider an empty string 
to be an unset value, and do the same checks in C and Perl.
3de072ae55 is described below

commit 3de072ae55185d6919291d04cb6afca5648346ad
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Oct 18 13:41:23 2024 +0200

    * tp/Texinfo/Translations.pm (translate_string),
    tp/Texinfo/XS/main/translations.c (translate_string): consider an
    empty string to be an unset value, and do the same checks in C and
    Perl.
---
 ChangeLog                         |  7 +++++++
 tp/TODO                           |  3 ---
 tp/Texinfo/Translations.pm        |  4 +++-
 tp/Texinfo/XS/main/translations.c | 11 +++--------
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 485be20fc5..6788c55be5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-18  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Translations.pm (translate_string),
+       tp/Texinfo/XS/main/translations.c (translate_string): consider an
+       empty string to be an unset value, and do the same checks in C and
+       Perl.
+
 2024-10-17  Gavin Smith <gavinsmith0123@gmail.com>
 
        * NEWS: State new installation location for texi2any files.
diff --git a/tp/TODO b/tp/TODO
index e6e8ddc8ae..7ddac82339 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,9 +10,6 @@ This is the todo list for texi2any
 Before next release
 ===================
 
-$srcdir/texi2any.pl --html --init=$srcdir/init/book.pm 
$srcdir/../doc/texinfo.texi -c documentlanguage fr
-
-
 Update search directories in C codes for the XDG Base Directory Specification
 based on what is done in Perl.  Need to wait to be clear on what is done
 in Perl.
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index 95efbab038..2fdca46e24 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -159,7 +159,9 @@ sub translate_string($$;$)
 {
   my ($string, $lang, $translation_context) = @_;
 
-  $lang = $DEFAULT_LANGUAGE if (!defined($lang));
+  # language is not checked if set as a customization variable, in that
+  # case it could be the empty string or any other string.
+  $lang = $DEFAULT_LANGUAGE if (!defined($lang) or $lang eq '');
 
   my ($saved_LC_MESSAGES, $saved_LANGUAGE);
 
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index d39aedaa67..fb08c335ae 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -186,16 +186,11 @@ translate_string (const char *string, const char *in_lang,
   static TEXT language_locales;
   int i;
 
-  if (!in_lang)
+  /* language is not checked if set as a customization variable, in that
+     case it could be the empty string or any other string. */
+  if (!in_lang || !strlen (in_lang))
     lang = "en";
 
-  if (strlen (lang) == 0)
-    {
-      fprintf (stderr, "For string '%s'\n", string);
-      bug ("BUG: defined but empty documentlanguage\n");
-      lang = "en";
-    }
-
 #ifndef ENABLE_NLS
   if (use_external_translate_string < 0)
     {



reply via email to

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