texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Report.pm (gdt): Set and restore LC_


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Report.pm (gdt): Set and restore LC_ALL rather than LC_MESSAGES as the latter doesn't work on MS-Windows. Report from Eli Zaretskii.
Date: Sat, 27 Feb 2021 15:56:52 -0500

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 1b8580f  * tp/Texinfo/Report.pm (gdt): Set and restore LC_ALL rather 
than LC_MESSAGES as the latter doesn't work on MS-Windows.  Report from Eli 
Zaretskii.
1b8580f is described below

commit 1b8580fe35a72dd1bb5a6df00cba9389ef34941c
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Feb 27 20:56:33 2021 +0000

    * tp/Texinfo/Report.pm (gdt): Set and restore LC_ALL rather than
    LC_MESSAGES as the latter doesn't work on MS-Windows.  Report
    from Eli Zaretskii.
---
 ChangeLog            |  6 ++++++
 tp/Texinfo/Report.pm | 14 ++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5746ba1..c365b60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2021-02-27  Gavin Smith  <gavinsmith0123@gmail.com>
 
+       * tp/Texinfo/Report.pm (gdt): Set and restore LC_ALL rather than
+       LC_MESSAGES as the latter doesn't work on MS-Windows.  Report
+       from Eli Zaretskii.
+
+2021-02-27  Gavin Smith  <gavinsmith0123@gmail.com>
+
        * texindex/Makefile.am (bin_SCRIPTS): Remove dist_ prefix
        from variable to prevent distribution of the generated texindex
        wrapper script.  Report by Bruno Haible.
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index e2cff29..d72b5ba 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -39,7 +39,7 @@ use strict;
 # for fileparse
 use File::Basename;
 
-use POSIX qw(setlocale LC_MESSAGES LC_ALL);
+use POSIX qw(setlocale LC_ALL);
 use Locale::Messages;
 # to be able to load a parser if none was given to gdt.
 use Texinfo::Parser;
@@ -241,7 +241,7 @@ sub gdt($$;$$)
   my $re = join '|', map { quotemeta $_ } keys %$context
       if (defined($context) and ref($context));
 
-  my $saved_LC_MESSAGES = POSIX::setlocale(LC_MESSAGES);
+  my $saved_LC_ALL = POSIX::setlocale(LC_ALL);
   my $saved_LANGUAGE = $ENV{'LANGUAGE'};
 
   # The following is necessary when the locale is "C" (as is the case
@@ -249,8 +249,10 @@ sub gdt($$;$$)
   #   https://rt.cpan.org/Public/Bug/Display.html?id=81315
   # Translation is not done if LC_MESSAGES is "C" or "POSIX".
   # This may not work if a locale named here doesn't exist on the system.
+  # Set LC_ALL rather than LC_MESSAGES as LC_MESSAGES may not be supported
+  # on Perl for MS-Windows.
   for my $try ('en_US.UTF-8', 'en_US') {
-    my $locale = POSIX::setlocale(LC_MESSAGES, $try);
+    my $locale = POSIX::setlocale(LC_ALL, $try);
     last if $locale;
   }
 
@@ -314,10 +316,10 @@ sub gdt($$;$$)
   } else {
     $ENV{'LANGUAGE'} = $saved_LANGUAGE;
   }
-  if (defined($saved_LC_MESSAGES)) {
-    POSIX::setlocale(LC_MESSAGES, $saved_LC_MESSAGES);
+  if (defined($saved_LC_ALL)) {
+    POSIX::setlocale(LC_ALL, $saved_LC_ALL);
   } else {
-    POSIX::setlocale(LC_MESSAGES, '');
+    POSIX::setlocale(LC_ALL, '');
   }
 
   if ($type and $type eq 'translated_text') {



reply via email to

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