Em qui., 5 de mar. de 2026 às 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ário should be Sumário
> > SumarÃssimo should be Sumaríssimo
>
> 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':
= = = transcription begins = = =
1
2 use strict;
3 use warnings;
4 use utf8
5
6 my %translations = (
7 'pt_BR' => {
8 'error@arrow{}' => {'' => 'error@arrow{}'},
9 'Next' => {'NodeNext direction string' => 'Próximo'},
10 ' ' => {'' => ' '},
11 'Table of contents' => {'Contents direction description'
=> 'Sumário'},
12 'Contents' => {'Contents direction string' => 'Conteúdo'},
13 'Index' => {'Index direction description' => 'Índice'},
14 'Index' => {'Index direction string' => 'Índice'},
15 ' ? ' => {'' => ' ? '},
16 '{number} {section_title}' => {'' => '{number} {section_title}'},
17 'Appendix {number} {section_title}' => {'' => 'Anexo
{number} {section_title}'},
18 'Short Table of Contents' => {'shortcontents section
heading' => 'Sumaríssimo'},
19 'Table of Contents' => {'contents section heading' => 'Sumário'},
20 '{element_text} ({title})' => {'' => '{element_text} ({title})'},
21 'Previous' => {'NodePrev direction string' => 'Anterior'},
22 'Up' => {'NodeUp direction string' => 'Acima'},
23 'see {reference_name}' => {'' => 'veja-se {reference_name}'},
24 'See {reference_name}' => {'' => 'Veja-se {reference_name}'},
25 '{reference} in @cite{{book}}' => {'' => '{reference} em
@cite{{book}}'},
26 'see @cite{{book_reference}}' => {'' => 'veja-se
@cite{{book_reference}}'},
27 'see {reference} in @cite{{book}}' => {'' => 'veja-se
{reference} em @cite{{book}}'},
28 '{reference_name}' => {'' => '{reference_name}'},
29 'See @cite{{book_reference}}' => {'' => 'Veja-se
@cite{{book_reference}}'},
30 'See {reference} in @cite{{book}}' => {'' => 'Veja-se
{reference} em @cite{{book}}'},
31 'Footnotes' => {'footnotes section heading' => 'Notas de Rodapé'},
32 '{explained_string} ({explanation})' => {'' =>
'{explained_string} ({explanation})'},
33 '@b{{quotation_arg}:} ' => {'' => '@b{{quotation_arg}:} '},
34 '@center --- @emph{{author}}' => {'' => '@center ---
@emph{{author}}'},
35 '{category}: ' => {'' => '{category}: '},
36 '{category} of @code{{class}}: ' => {'' => '{category}
da @code{{class}}: '},
37 '@cite{{book_reference}}' => {'' => '@cite{{book_reference}}'},
38 'Jump to' => {'' => 'Pular para'},
39 'The node you are looking for is at {href}.' => {'' =>
'O nó que você está procurando está em {href}.'},
40 'Index' => {'Index direction description' => 'Índice'},
41 'Function' => {'category of functions for @defun' => 'Função'},
42 'Special Form' => {'' => 'Forma Especial'},
43 'Instance Variable' => {'category of instance variables
in object-oriented programming for @defivar' => 'Variável de
Instância'},
44 'Instance Variable' => {'category of instance variables
with data type in object-oriented programming for @deftypeivar' =>
'Variável de Instância'},
45 },
46 );
47
48 my $seen_translated = {};
49 my $translated_lang = 'pt_BR';
50
51 sub my_format_translate_message($$$;$) {
52 my ($converter, $string, $lang, $translation_context) = @_;
53
54 $translation_context = '' if (!defined($translation_context));
55
56 # uncomment next lines to have the strings to translate being printed
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' =>
{'$translation_context' => ''},\n";
63 # }
64 # $seen_translated->{"$string-$translation_context"} = 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 =
$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_message);
79
80 sub my_reset_seen_translated {
81 $seen_translated = {};
82
83 return 0;
84 }
85
86 texinfo_register_handler('setup', \&my_reset_seen_translated);
87
88 1;
= = = transcription ends = = =
Output of 'texi2any --html --init-file ./t2a_modify_translations.pm':
= = = transcription begins = = =
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.
= = = transcription ends = = =
> Also you need to make sure that the strings in
> t2a_modify_translations.pm are actually UTF-8 encoded.
>
Output of 'LC_ALL=C file t2a_modify_translations.pm':
t2a_modify_translations.pm: Unicode text, UTF-8 text, with CRLF line terminators
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