On Sun, Jan 25, 2026 at 12:17:39AM +0000, Gavin Smith wrote:
> I couldn't make it work either. I don't know what is going on with the
> POSIX::setlocale function in Perl.
There is a trick that appears to work:
diff --git a/tta/perl/Texinfo/Translations.pm b/tta/perl/Texinfo/Translations.pm
index 65808a7e86..f6c9cd5a78 100644
--- a/tta/perl/Texinfo/Translations.pm
+++ b/tta/perl/Texinfo/Translations.pm
@@ -33,6 +33,10 @@ use strict;
use Encode;
use POSIX qw(setlocale LC_ALL LC_MESSAGES);
use Carp qw(cluck confess);
+
+sub fake_setlocale { return "en_US.UTF-8"; }
+BEGIN {*POSIX::setlocale = \&fake_setlocale; }
+
use Locale::Messages;
use Storable qw(dclone);
If we override the "setlocale" locale in the POSIX:: namespace before
the Locale::Messages module is loaded, then all of the calls will go
to our overload instead.
With this, translations do occur in the output.
We should probably only use this trick as a last resort.
The test still fails, which we could probably work around somehow:
$ test_scripts/layout_formatting_fr_info.sh
D: layout/diffs/formatting_fr_info.diff (printed below)
diff -a -u -r ./layout/res_parser/formatting_fr_info/formatting.2
layout/out_parser/formatting_fr_info/formatting.2
--- ./layout/res_parser/formatting_fr_info/formatting.2 Thu Jan 1 22:38:11 2026
+++ layout/out_parser/formatting_fr_info/formatting.2 Sun Jan 25 00:48:28 2026
@@ -1,3 +1,4 @@
+Subroutine POSIX::setlocale redefined at
..//perl//../perl/Texinfo/Translations.pm line 38.
formatting.texi:22: warning: @clickstyle is obsolete (possibly involving
@mymacro)
formatting.texi:22: warning: @clickstyle is obsolete (possibly involving
@mymacro)
formatting.texi:22: @| should only appear in heading or footing (possibly
involving @mymacro)
D: layout/diffs/formatting_fr_info.diff (printed above)
testdir: layout
driving_file: ./layout/list-of-tests
made result dir: ./layout/res_parser/
doing test formatting_fr_info, src_file ./layout/../coverage/formatting.texi
format_option:
perl/texi2any.pl formatting_fr_info -> layout/out_parser/formatting_fr_info
/usr/bin/perl -w ./..//perl/texi2any.pl --force --conf-dir ./../perl/t/init/
--conf-dir ./../perl/init --conf-dir ./../perl/ext -I ./layout -I layout/ -I ./
-I . -I built_input -I built_input/non_ascii --error-limit=1000 -c TEST=1
--output layout/out_parser/formatting_fr_info/ -D 'needcollationcompat Need
collation compatibility' --info --document-language fr
./layout/../coverage/formatting.texi >
layout/out_parser/formatting_fr_info/formatting.1
2>layout/out_parser/formatting_fr_info/formatting.2
all done, exiting with status 1