Re: Re: Re: Localized English words ('See', 'see', 'Short Table of Contents') (TeX output)

Jamenson Espindula <[email protected]> Thu, 5 Mar 2026 05:39:52 -0300
Newsgroups gmane.comp.tex.texinfo.general
Message-ID <CAOW_YOngPi11O1hK7+44q51j3GPyCFM7=5-RHymHiQe-pVwe5Q@mail.gmail.com>
Em qui., 5 de mar. de 2026 =C3=A0s 04:52, Patrice Dumas <[email protected]> =
escreveu:
>
> On Thu, Mar 05, 2026 at 01:13:29AM -0300, Jamenson Espindula wrote:
> > I confirm that the texi2any '--init-file t2a_modify_translations.pm'
> > option works perfectly.
> >
> > Some changes were mandatory: 'pt' does not work, as the input file,
> > 'texinfo.pt_BR.texi', has an '@documentlanguage pt_BR' Texinfo
> > @-command.
>
> Indeed.
>
> > That said, some words are being put in the HTML with strange
> > characters. Below are some examples:
> >
> > Sum=C3=83=C2=A1rio should be Sum=C3=A1rio
> > Sumar=C3=83=C2=ADssimo should be Sumar=C3=ADssimo
>
> I do not reproduce the issue.  What is your Perl version?  You may need
> to add near the beginning of t2a_modify_translations.pm:
>
> use utf8;
>
Below is the actual content of the 't2a_modify_translations.pm':

 =3D =3D =3D transcription begins =3D =3D =3D

    1

    2 use strict;

    3 use warnings;

    4 use utf8

    5

    6 my %translations =3D (

    7   'pt_BR' =3D> {

    8         'error@arrow{}' =3D> {'' =3D> 'error@arrow{}'},

    9         'Next' =3D> {'NodeNext direction string' =3D> 'Pr=C3=B3ximo'}=
,

   10         ' &nbsp; ' =3D> {'' =3D> ' &nbsp; '},

   11         'Table of contents' =3D> {'Contents direction description'
=3D> 'Sum=C3=A1rio'},

   12         'Contents' =3D> {'Contents direction string' =3D> 'Conte=C3=
=BAdo'},

   13         'Index' =3D> {'Index direction description' =3D> '=C3=8Dndice=
'},

   14         'Index' =3D> {'Index direction string' =3D> '=C3=8Dndice'},

   15         ' ? ' =3D> {'' =3D> ' ? '},

   16         '{number} {section_title}' =3D> {'' =3D> '{number} {section_t=
itle}'},

   17         'Appendix {number} {section_title}' =3D> {'' =3D> 'Anexo
{number} {section_title}'},

   18         'Short Table of Contents' =3D> {'shortcontents section
heading' =3D> 'Sumar=C3=ADssimo'},

   19         'Table of Contents' =3D> {'contents section heading' =3D> 'Su=
m=C3=A1rio'},

   20         '{element_text} ({title})' =3D> {'' =3D> '{element_text} ({ti=
tle})'},

   21         'Previous' =3D> {'NodePrev direction string' =3D> 'Anterior'}=
,

   22         'Up' =3D> {'NodeUp direction string' =3D> 'Acima'},

   23         'see {reference_name}' =3D> {'' =3D> 'veja-se {reference_name=
}'},

   24         'See {reference_name}' =3D> {'' =3D> 'Veja-se {reference_name=
}'},

   25         '{reference} in @cite{{book}}' =3D> {'' =3D> '{reference} em
@cite{{book}}'},

   26         'see @cite{{book_reference}}' =3D> {'' =3D> 'veja-se
@cite{{book_reference}}'},

   27         'see {reference} in @cite{{book}}' =3D> {'' =3D> 'veja-se
{reference} em @cite{{book}}'},

   28         '{reference_name}' =3D> {'' =3D> '{reference_name}'},

   29         'See @cite{{book_reference}}' =3D> {'' =3D> 'Veja-se
@cite{{book_reference}}'},

   30         'See {reference} in @cite{{book}}' =3D> {'' =3D> 'Veja-se
{reference} em @cite{{book}}'},

   31         'Footnotes' =3D> {'footnotes section heading' =3D> 'Notas de =
Rodap=C3=A9'},

   32         '{explained_string} ({explanation})' =3D> {'' =3D>
'{explained_string} ({explanation})'},

   33         '@b{{quotation_arg}:} ' =3D> {'' =3D> '@b{{quotation_arg}:} '=
},

   34         '@center --- @emph{{author}}' =3D> {'' =3D> '@center ---
@emph{{author}}'},

   35         '{category}: ' =3D> {'' =3D> '{category}: '},

   36         '{category} of @code{{class}}: ' =3D> {'' =3D> '{category}
da @code{{class}}: '},

   37         '@cite{{book_reference}}' =3D> {'' =3D> '@cite{{book_referenc=
e}}'},

   38         'Jump to' =3D> {'' =3D> 'Pular para'},

   39         'The node you are looking for is at {href}.' =3D> {'' =3D>
'O n=C3=B3 que voc=C3=AA est=C3=A1 procurando est=C3=A1 em {href}.'},

   40         'Index' =3D> {'Index direction description' =3D> '=C3=8Dndice=
'},

   41         'Function' =3D> {'category of functions for @defun' =3D> 'Fun=
=C3=A7=C3=A3o'},

   42         'Special Form' =3D> {'' =3D> 'Forma Especial'},

   43         'Instance Variable' =3D> {'category of instance variables
in object-oriented programming for @defivar' =3D> 'Vari=C3=A1vel de
Inst=C3=A2ncia'},

   44         'Instance Variable' =3D> {'category of instance variables
with data type in object-oriented programming for @deftypeivar' =3D>
'Vari=C3=A1vel de Inst=C3=A2ncia'},

   45    },

   46 );

   47

   48 my $seen_translated =3D {};

   49 my $translated_lang =3D 'pt_BR';

   50

   51 sub my_format_translate_message($$$;$) {

   52   my ($converter, $string, $lang, $translation_context) =3D @_;

   53

   54   $translation_context =3D '' if (!defined($translation_context));

   55

   56   # uncomment next lines to have the strings to translate being print=
ed

   57   #if (!exists($seen_translated->{"$string-$translation_context"})) {

   58   #  if (!exists($translations{$translated_lang})

   59   #      or !exists($translations{$translated_lang}->{$string})

   60   #      or !exists($translations{$translated_lang}->{$string}

   61   #                                        ->{$translation_context}))=
 {

   62   #    print STDERR "       # '$string' =3D>
{'$translation_context' =3D> ''},\n";

   63   #  }

   64   #  $seen_translated->{"$string-$translation_context"} =3D 1;

   65   #}

   66

   67   return $string if (!defined($lang) or $lang eq '');

   68   if (exists($translations{$lang})

   69       and exists($translations{$lang}->{$string})

   70       and
exists($translations{$lang}->{$string}->{$translation_context})) {

   71     my $translation =3D
$translations{$lang}->{$string}->{$translation_context};

   72     return $translation;

   73   }

   74   return undef;

   75 }

   76

   77 texinfo_register_formatting_function('format_translate_message',

   78                                           \&my_format_translate_messa=
ge);

   79

   80 sub my_reset_seen_translated {

   81   $seen_translated =3D {};

   82

   83   return 0;

   84 }

   85

   86 texinfo_register_handler('setup', \&my_reset_seen_translated);

   87

   88 1;

 =3D =3D =3D transcription ends =3D =3D =3D

Output of 'texi2any --html --init-file ./t2a_modify_translations.pm':

=3D =3D =3D transcription begins =3D =3D =3D

    1 texi2any: error parsing ./t2a_modify_translations.pm: Global
symbol "%translations" requires explicit package name (did you forget
to declare "my %translations"?) at ./t2a_modify_translations.pm line
68.

    2 Global symbol "%translations" requires explicit package name
(did you forget to declare "my %translations"?) at
./t2a_modify_translations.pm line 69.

    3 Global symbol "%translations" requires explicit package name
(did you forget to declare "my %translations"?) at
./t2a_modify_translations.pm line 70.

    4 Global symbol "%translations" requires explicit package name
(did you forget to declare "my %translations"?) at
./t2a_modify_translations.pm line 71.

 =3D =3D =3D transcription ends =3D =3D =3D

> Also you need to make sure that the strings in
> t2a_modify_translations.pm are actually UTF-8 encoded.
>

Output of 'LC_ALL=3DC file t2a_modify_translations.pm':

t2a_modify_translations.pm: Unicode text, UTF-8 text, with CRLF line termin=
ators


Output of '/usr/bin/perl --version':

This is perl 5, version 42, subversion 0 (v5.42.0) built for
x86_64-linux-thread-multi


Jamenson Espindula