[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 2 Feb 2024 13:06:12 -0500 (EST) |
branch: master
commit 3e5edc5b00d65797e13feb373903fa09f60c5c46
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 2 13:56:37 2024 +0100
* doc/texi2any_api.texi (Translations Output and Customization),
(Internationalization of Strings Function), po_document/Makevars
(XGETTEXT_OPTIONS), tp/Texinfo/Convert/Converter.pm (cdt, cdt_string)
(pcdt), tp/Texinfo/Convert/*.pm, tp/Texinfo/Translations.pm
(translate_string, gdt, gdt_string, pgdt): do not set language in
gdt, gdt_string, pgdt, instead get it as argument. Change the
arguments order to have $lang appear earlier. Add wrappers for
converters, called cdt, cdt_string and pcdt that set the language with
get_conf('documentlanguage'). Update callers.
---
ChangeLog | 12 ++
doc/texi2any_api.texi | 35 +++---
po_document/Makevars | 1 +
tp/Texinfo/Convert/Converter.pm | 97 ++++++++++++++--
tp/Texinfo/Convert/DocBook.pm | 46 ++++----
tp/Texinfo/Convert/HTML.pm | 142 ++++++++++++------------
tp/Texinfo/Convert/LaTeX.pm | 14 +--
tp/Texinfo/Convert/Plaintext.pm | 82 +++++++-------
tp/Texinfo/Convert/Text.pm | 6 +-
tp/Texinfo/Convert/Utils.pm | 10 +-
tp/Texinfo/Structuring.pm | 7 +-
tp/Texinfo/Translations.pm | 95 ++++++++--------
tp/ext/epub3.pm | 2 +-
tp/init/html32.pm | 2 +-
tp/t/init/mini_ker_t2h.init | 2 +-
tp/t/init/translate_txiinternalvalue_macro.init | 2 +-
tp/texi2any.pl | 2 +-
17 files changed, 320 insertions(+), 237 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 273bc613b2..a07d80a0d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-02-02 Patrice Dumas <pertusus@free.fr>
+
+ * doc/texi2any_api.texi (Translations Output and Customization),
+ (Internationalization of Strings Function), po_document/Makevars
+ (XGETTEXT_OPTIONS), tp/Texinfo/Convert/Converter.pm (cdt, cdt_string)
+ (pcdt), tp/Texinfo/Convert/*.pm, tp/Texinfo/Translations.pm
+ (translate_string, gdt, gdt_string, pgdt): do not set language in
+ gdt, gdt_string, pgdt, instead get it as argument. Change the
+ arguments order to have $lang appear earlier. Add wrappers for
+ converters, called cdt, cdt_string and pcdt that set the language with
+ get_conf('documentlanguage'). Update callers.
+
2024-02-02 Patrice Dumas <pertusus@free.fr>
No encoding, no us-ascii added to locale for document translations
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 786aeeeb76..e21227b744 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -3284,7 +3284,7 @@ Customization}) and for specific elements headings such
as footnotes,
contents or about (@pxref{Special Units Information Customization}).
Translated strings can also be inserted in the output in user-defined
customization functions, by using specific functions for internationalization
-of strings, @code{gdt}, @code{gdt_string} or @code{pgdt}.
+of strings, @code{cdt}, @code{cdt_string} or @code{cgdt}.
It is possible to customize the translated strings, in order to
change the translations of the strings translated in the default case.
@@ -3298,30 +3298,30 @@ information on the default case.
@section Internationalization of Strings Function
@vindex texinfo_document @r{Gettext domain}
-The subroutines @code{gdt}, @code{gdt_string} or @code{pgdt}, are used for
+The subroutines @code{cdt}, @code{cdt_string} or @code{cgdt}, are used for
translated strings:
-@deftypefun {@var{$translated_tree} =} @var{$converter}->gdt (@var{$string},
@var{\%variables_hash}, @var{$translation_context})
-@deftypefunx {@var{$translated_string} =} @var{$converter}->gdt_string
(@var{$string}, @var{\%variables_hash}, @var{$translation_context})
-@deftypefunx {@var{$translated_tree} =} @var{$converter}->pgdt
(@var{$translation_context}, @var{$string}, @var{\%variables_hash})
+@deftypefun {@var{$translated_tree} =} @var{$converter}->cdt (@var{$string},
@var{\%variables_hash}, @var{$translation_context})
+@deftypefunx {@var{$translated_string} =} @var{$converter}->cdt_string
(@var{$string}, @var{\%variables_hash}, @var{$translation_context})
+@deftypefunx {@var{$translated_tree} =} @var{$converter}->pcdt
(@var{$translation_context}, @var{$string}, @var{\%variables_hash})
@var{$string} is the string to be translated, @var{\%variables_hash}
is a hash reference holding the variable parts of the translated
string. @var{$translation_context} is an optional translation context
that limits the search of the translated string to that context
(@pxref{Contexts,,,gettext,GNU gettext tools}).
-The result returned is a perl Texinfo tree for @code{gdt} and @code{pgdt}
-and a string for @code{gdt_string}. With @code{gdt_string} the substitutions
+The result returned is a perl Texinfo tree for @code{cdt} and @code{pcdt}
+and a string for @code{cdt_string}. With @code{cdt_string} the substitutions
may only be strings.
-If called as @code{pgdt}, @var{$translation_context} is not optional
+If called as @code{pcdt}, @var{$translation_context} is not optional
and is the first argument.
@end deftypefun
-With @code{gdt} and @code{pgdt}, when the string is expanded as Texinfo, and
+With @code{cdt} and @code{pcdt}, when the string is expanded as Texinfo, and
converted to a Texinfo tree in perl, the arguments are substituted; for
example, @samp{@{arg_name@}} is replaced by the corresponding actual argument,
-which should be a Texinfo tree element. With @code{gdt_string}, the string
+which should be a Texinfo tree element. With @code{cdt_string}, the string
should already be converted, the arguments are substituted as strings; for
example @samp{@{arg_name@}} is replaced by the corresponding actual argument,
which should be a string.
@@ -3335,7 +3335,7 @@ substituted after the expansion, which means that they
should already be
Texinfo tree elements.
@example
- $converter->gdt('Generated @@emph@{@@today@{@}@} using '
+ $converter->cdt('Generated @@emph@{@@today@{@}@} using '
.'@@uref@{@{homepage@}, @@emph@{@{program@}@}@}.',
@{ 'homepage' => @{ 'text' => $converter->get_conf('PACKAGE_URL') @},
'program' => @{ 'text' => $converter->get_conf('PROGRAM') @}@}));
@@ -3343,7 +3343,7 @@ Texinfo tree elements.
An example of combining conversion with translation:
@example
-$converter->convert_tree($converter->gdt(
+$converter->convert_tree($converter->cdt(
'@{explained_string@} (@{explanation@})',
@{'explained_string' => @{'type' => '_converted',
'text' => $result@},
@@ -3353,13 +3353,14 @@ $converter->convert_tree($converter->gdt(
@end example
In the default case, the functions from the @code{Texinfo::Translations}
-module are used for translated strings. It is possible to use user-defined
-functions instead as seen next.
@xref{Texinfo::Translations,,,texi2any_internals} for more
-on @code{Texinfo::Translations}.
+module are used for translated strings through converter functions. It is
+possible to use user-defined functions instead as seen next.
+@xref{Texinfo::Translations,,,texi2any_internals} for more on
+@code{Texinfo::Translations}.
-In @command{texi2any} code, @code{gdt} and @code{gdt_string} are also used to
+In @command{texi2any} code, @code{cdt} and @code{cdt_string} are also used to
mark translated strings for tools extracting translatable strings to produce
-template files. @code{pgdt} is used to mark translated string with a
+template files. @code{pcdt} is used to mark translated string with a
translation context associated.
diff --git a/po_document/Makevars b/po_document/Makevars
index a43e8baf98..081049f7ab 100644
--- a/po_document/Makevars
+++ b/po_document/Makevars
@@ -11,6 +11,7 @@ top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = -cTRANSLATORS --language=Perl \
--keyword=gdt --keyword=gdt_string --keyword=pgdt:1c,2 \
+ --keyword=cdt --keyword=cdt_string --keyword=pcdt:1c,2 \
--keyword=pgdt_context:1c,2 --from-code=UTF-8
# This is the copyright holder that gets inserted into the header of the
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 91be2b2bcd..ea330b150a 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -182,7 +182,7 @@ my %all_converters_defaults
if (0) {
my $self;
# TRANSLATORS: expansion of @error{} as Texinfo code
- $self->gdt('error@arrow{}');
+ $self->cdt('error@arrow{}');
}
our %default_args_code_style = (
@@ -626,6 +626,35 @@ sub destroy($)
{
}
+sub cdt($$;$$)
+{
+ my ($self, $string, $replaced_substrings, $translation_context) = @_;
+
+ return Texinfo::Translations::gdt($self, $string,
+ $self->get_conf('documentlanguage'),
+ $replaced_substrings,
+ $translation_context);
+}
+
+sub cdt_string($$;$$)
+{
+ my ($self, $string, $replaced_substrings, $translation_context) = @_;
+
+ return Texinfo::Translations::gdt_string($self, $string,
+ $self->get_conf('documentlanguage'),
+ $replaced_substrings,
+ $translation_context);
+}
+
+sub pcdt($$;$$)
+{
+ my ($self, $translation_context, $string, $replaced_substrings) = @_;
+
+ return Texinfo::Translations::pgdt($self, $translation_context, $string,
+ $self->get_conf('documentlanguage'),
+ $replaced_substrings);
+}
+
sub converter_line_error($$$;$)
{
my $self = shift;
@@ -633,7 +662,7 @@ sub converter_line_error($$$;$)
my $error_location_info = shift;
my $continuation = shift;
- my $message = Texinfo::Report::format_line_message ('error', $text,
+ my $message = Texinfo::Report::format_line_message('error', $text,
$error_location_info, $continuation,
$self->get_conf('DEBUG'));
push @{$self->{'error_warning_messages'}}, $message;
@@ -646,7 +675,7 @@ sub converter_line_warn($$$;$)
my $error_location_info = shift;
my $continuation = shift;
- my $message = Texinfo::Report::format_line_message ('warning', $text,
+ my $message = Texinfo::Report::format_line_message('warning', $text,
$error_location_info, $continuation,
$self->get_conf('DEBUG'));
push @{$self->{'error_warning_messages'}}, $message;
@@ -1524,15 +1553,15 @@ sub float_type_number($$)
my $tree;
if ($type_element) {
if (defined($float_number)) {
- $tree = $self->gdt("{float_type} {float_number}",
+ $tree = $self->cdt("{float_type} {float_number}",
{'float_type' => $type_element,
'float_number' => {'text' => $float_number}});
} else {
- $tree = $self->gdt("{float_type}",
+ $tree = $self->cdt("{float_type}",
{'float_type' => $type_element});
}
} elsif (defined($float_number)) {
- $tree = $self->gdt("{float_number}",
+ $tree = $self->cdt("{float_number}",
{'float_number' => {'text' => $float_number}});
}
return $tree;
@@ -1572,24 +1601,24 @@ sub float_name_caption($$)
if ($caption_element) {
if ($float_number_element) {
# TRANSLATORS: added before caption
- $prepended = $self->gdt('{float_type} {float_number}: ', $substrings);
+ $prepended = $self->cdt('{float_type} {float_number}: ', $substrings);
} else {
# TRANSLATORS: added before caption, no float label
- $prepended = $self->gdt('{float_type}: ', $substrings);
+ $prepended = $self->cdt('{float_type}: ', $substrings);
}
} else {
if ($float_number_element) {
- $prepended = $self->gdt("{float_type} {float_number}", $substrings);
+ $prepended = $self->cdt("{float_type} {float_number}", $substrings);
} else {
- $prepended = $self->gdt("{float_type}", $substrings);
+ $prepended = $self->cdt("{float_type}", $substrings);
}
}
} elsif ($float_number_element) {
if ($caption_element) {
# TRANSLATORS: added before caption, no float type
- $prepended = $self->gdt('{float_number}: ', $substrings);
+ $prepended = $self->cdt('{float_number}: ', $substrings);
} else {
- $prepended = $self->gdt("{float_number}", $substrings);
+ $prepended = $self->cdt("{float_number}", $substrings);
}
}
return ($caption_element, $prepended);
@@ -2484,6 +2513,50 @@
Texinfo::Report::add_formatted_message|Texinfo::Report/$registrar->add_formatted
=back
+=head2 Translations in output documents
+
+C<Texinfo::Convert::Converter> provides wrappers around
+L<Texinfo::Translations> methods that sets the language to the current
+C<documentlanguage>.
+
+The C<cdt> and C<pcdt> methods are used to translate strings to be output in
+converted documents, and return a Texinfo tree. The C<cdt_string> is similar
+but returns a simple string, for already converted strings.
+
+=over
+
+=item $tree = $converter->cdt($string, $replaced_substrings,
$translation_context)
+
+=item $string = $converter->cdt_string($string, $replaced_substrings,
$translation_context)
+X<C<cdt>> X<C<cdt_string>>
+
+The I<$string> is a string to be translated. With C<cdt>
+the function returns a Texinfo tree, as the string is interpreted
+as Texinfo code after translation. With C<cdt_string> a string
+is returned.
+
+I<$replaced_substrings> is an optional hash reference specifying
+some substitution to be done after the translation. The key of the
+I<$replaced_substrings> hash reference identifies what is to be substituted.
+In the string to be translated word in brace matching keys of
+I<$replaced_substrings> are replaced.
+For C<cdt>, the value is a Texinfo tree that is substituted in the
+resulting texinfo tree. For C<cdt_string>, the value is a string that
+is replaced in the resulting string.
+
+The I<$translation_context> is optional. If not C<undef> this is a translation
+context string for I<$string>. It is the first argument of C<pgettext>
+in the C API of Gettext.
+
+=item $tree = $object->pcdt($translation_context, $string,
$replaced_substrings)
+X<C<pcdt>>
+
+Same to C<cdt> except that the I<$translation_context> is not optional.
+This function is useful to mark strings with a translation context for
+translation. This function is similar to pgettext in the Gettext C API.
+
+=back
+
=head2 Conversion to XML
Some C<Texinfo::Convert::Converter> methods target conversion to XML.
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index cd896d4ec1..aa4cebff9c 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1143,49 +1143,49 @@ sub _convert($$;$)
if ($section_name) {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('section ``{section_name}\'\' in @cite{{book}}',
+ $self->cdt('section ``{section_name}\'\' in @cite{{book}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'book' => $book_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See section ``{section_name}\'\' in
@cite{{book}}',
+ $self->cdt('See section ``{section_name}\'\' in
@cite{{book}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'book' => $book_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see section ``{section_name}\'\' in
@cite{{book}}',
+ $self->cdt('see section ``{section_name}\'\' in
@cite{{book}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'book' => $book_element }));
}
} elsif ($node_name) {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('``{node_name}\'\' in @cite{{book}}',
+ $self->cdt('``{node_name}\'\' in @cite{{book}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'book' => $book_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See ``{node_name}\'\' in @cite{{book}}',
+ $self->cdt('See ``{node_name}\'\' in @cite{{book}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'book' => $book_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see ``{node_name}\'\' in @cite{{book}}',
+ $self->cdt('see ``{node_name}\'\' in @cite{{book}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'book' => $book_element }));
}
} else {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('@cite{{book}}',
+ $self->cdt('@cite{{book}}',
{'book' => $book_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See @cite{{book}}',
+ $self->cdt('See @cite{{book}}',
{'book' => $book_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see @cite{{book}}',
+ $self->cdt('see @cite{{book}}',
{'book' => $book_element }));
}
}
@@ -1193,49 +1193,49 @@ sub _convert($$;$)
if ($section_name) {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('section ``{section_name}\'\' in @file{{manual}}',
+ $self->cdt('section ``{section_name}\'\' in @file{{manual}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'manual' => $manual_file_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See section ``{section_name}\'\' in
@file{{manual}}',
+ $self->cdt('See section ``{section_name}\'\' in
@file{{manual}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'manual' => $manual_file_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see section ``{section_name}\'\' in
@file{{manual}}',
+ $self->cdt('see section ``{section_name}\'\' in
@file{{manual}}',
{ 'section_name' => {'type' => '_converted', 'text' =>
$section_name},
'manual' => $manual_file_element }));
}
} elsif ($node_name) {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('``{node_name}\'\' in @file{{manual}}',
+ $self->cdt('``{node_name}\'\' in @file{{manual}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'manual' => $manual_file_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See ``{node_name}\'\' in @file{{manual}}',
+ $self->cdt('See ``{node_name}\'\' in @file{{manual}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'manual' => $manual_file_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see ``{node_name}\'\' in @file{{manual}}',
+ $self->cdt('see ``{node_name}\'\' in @file{{manual}}',
{ 'node_name' => {'type' => '_converted', 'text' =>
$node_name},
'manual' => $manual_file_element }));
}
} else {
if ($cmdname eq 'ref') {
$result = $self->_convert(
- $self->gdt('@file{{manual}}',
+ $self->cdt('@file{{manual}}',
{'manual' => $manual_file_element }));
} elsif ($cmdname eq 'xref') {
$result = $self->_convert(
- $self->gdt('See @file{{manual}}',
+ $self->cdt('See @file{{manual}}',
{'manual' => $manual_file_element }));
} elsif ($cmdname eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see @file{{manual}}',
+ $self->cdt('see @file{{manual}}',
{'manual' => $manual_file_element }));
}
}
@@ -1255,17 +1255,17 @@ sub _convert($$;$)
if ($element->{'cmdname'} eq 'ref'
or $element->{'cmdname'} eq 'link') {
$result = $self->_convert(
- $self->gdt('{title_ref}', {'title_ref' =>
+ $self->cdt('{title_ref}', {'title_ref' =>
{'type' => '_converted',
'text' => $argument}}));
} elsif ($element->{'cmdname'} eq 'xref') {
$result = $self->_convert(
- $self->gdt('See {title_ref}', {'title_ref' =>
+ $self->cdt('See {title_ref}', {'title_ref' =>
{'type' => '_converted',
'text' => $argument}}));
} elsif ($element->{'cmdname'} eq 'pxref') {
$result = $self->_convert(
- $self->gdt('see {title_ref}', {'title_ref' =>
+ $self->cdt('see {title_ref}', {'title_ref' =>
{'type' => '_converted',
'text' => $argument}}));
}
@@ -1447,7 +1447,7 @@ sub _convert($$;$)
and $element->{'args'}->[-1]->{'contents'}
and @{$element->{'args'}->[-1]->{'contents'}}) {
if (defined($argument)) {
- my $tree = $self->gdt('{abbr_or_acronym} ({explanation})',
+ my $tree = $self->cdt('{abbr_or_acronym} ({explanation})',
{'abbr_or_acronym' => {'type' => '_converted',
'text' => $argument},
'explanation' =>
@@ -1633,7 +1633,7 @@ sub _convert($$;$)
$format_element = lc($quotation_arg_text);
} else {
$self->{'pending_prepend'}
- = $self->_convert($self->gdt('@b{{quotation_arg}:} ',
+ = $self->_convert($self->cdt('@b{{quotation_arg}:} ',
{'quotation_arg' =>
$element->{'args'}->[0]}));
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 53363f77da..5e66de92a3 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1273,11 +1273,11 @@ sub _internal_command_tree($$$)
if ($command->{'cmdname'} eq 'appendix'
and $command->{'extra'}->{'section_level'} == 1) {
- $tree = $self->gdt('Appendix {number} {section_title}',
+ $tree = $self->cdt('Appendix {number} {section_title}',
$substituted_strings);
} else {
# TRANSLATORS: numbered section title
- $tree = $self->gdt('{number} {section_title}',
+ $tree = $self->cdt('{number} {section_title}',
$substituted_strings);
}
} else {
@@ -1763,7 +1763,7 @@ sub direction_string($$$;$)
}
if (defined($context_converted_string)) {
my $result_string
- = $self->gdt_string($context_converted_string);
+ = $self->cdt_string($context_converted_string);
$self->{'directions_strings'}->{$string_type}->{$direction}->{$context}
= $self->substitute_html_non_breaking_space($result_string);
} else {
@@ -1778,7 +1778,7 @@ sub direction_string($$$;$)
$translation_context .= ' direction '
.$direction_type_translation_context{$string_type};
my $translated_tree
- = $self->pgdt($translation_context,
+ = $self->pcdt($translation_context,
$translated_directions_strings->{$string_type}
->{$direction}->{'to_convert'});
my $converted_tree;
@@ -1840,7 +1840,7 @@ sub special_unit_info($$$) {
my $translated_tree;
if (defined($special_unit_info_string)) {
my $translation_context = "$special_unit_variety section heading";
- $translated_tree = $self->pgdt($translation_context,
+ $translated_tree = $self->pcdt($translation_context,
$special_unit_info_string);
}
$self->{'special_unit_info'}->{$type}->{$special_unit_variety}
@@ -2811,13 +2811,13 @@ sub _translate_names($)
->{$command}->{$context}->{'unset'}) {
$translated_commands{$command} = 1;
$self->{'no_arg_commands_formatting'}->{$command}->{$context}->{'text'}
- = $self->gdt_string($self->{'no_arg_commands_formatting'}
+ = $self->cdt_string($self->{'no_arg_commands_formatting'}
->{$command}->{$context}->{'translated_converted'});
} elsif ($context eq 'normal') {
my $translated_tree;
if (defined($self->{'no_arg_commands_formatting'}
->{$command}->{$context}->{'translated_to_convert'})) {
- $translated_tree = $self->gdt($self->{'no_arg_commands_formatting'}
+ $translated_tree = $self->cdt($self->{'no_arg_commands_formatting'}
->{$command}->{$context}->{'translated_to_convert'});
} else {
# default translated commands
@@ -2844,7 +2844,7 @@ sub _translate_names($)
# Texinfo::Translations::translate_string redefined to call user defined
function.
sub translate_string($$;$$)
{
- my ($self, $string, $translation_context, $lang) = @_;
+ my ($self, $string, $lang, $translation_context) = @_;
if (defined($self->{'formatting_function'}->{'format_translate_message'})) {
my $format_lang = $lang;
$format_lang = $self->get_conf('documentlanguage')
@@ -2857,7 +2857,7 @@ sub translate_string($$;$$)
}
}
- return $self->SUPER::translate_string($string, $translation_context, $lang);
+ return $self->SUPER::translate_string($string, $lang, $translation_context);
}
sub converter_defaults($$)
@@ -3088,7 +3088,7 @@ $default_no_arg_commands_formatting{'normal'}->{"\n"} =
{'text' => ' '};
## This is used to have gettext pick up the chain to be translated
#if (0) {
# my $not_existing;
-# $not_existing->gdt('error-->');
+# $not_existing->cdt('error-->');
#}
$default_no_arg_commands_formatting{'normal'}->{'enddots'}
@@ -3486,7 +3486,7 @@ sub _convert_value_command($$$$)
my $command = shift;
my $args = shift;
- return $self->convert_tree($self->gdt('@{No value for `{value}\'@}',
+ return $self->convert_tree($self->cdt('@{No value for `{value}\'@}',
{'value' => {'text' => $args->[0]->{'monospacestring'}}}));
}
@@ -3576,7 +3576,7 @@ sub _convert_explained_command($$$$)
if ($args and $args->[1] and defined($args->[1]->{'normal'})) {
my $explanation_result = $args->[1]->{'normal'};
# TRANSLATORS: abbreviation or acronym explanation
- $result = $self->convert_tree($self->gdt('{explained_string}
({explanation})',
+ $result = $self->convert_tree($self->cdt('{explained_string}
({explanation})',
{'explained_string' => {'type' => '_converted',
'text' => $result},
'explanation' => {'type' => '_converted',
@@ -5609,7 +5609,7 @@ sub _convert_quotation_command($$$$$)
if ($author->{'args'}->[0]
and $author->{'args'}->[0]->{'contents'}) {
# TRANSLATORS: quotation author
- my $centered_author = $self->gdt("\@center --- \@emph{{author}}",
+ my $centered_author = $self->cdt("\@center --- \@emph{{author}}",
{'author' => $author->{'args'}->[0]});
$centered_author->{'parent'} = $command;
$result .= $self->convert_tree($centered_author,
@@ -6027,11 +6027,11 @@ sub _convert_xref_commands($$$$)
= { 'reference_name' => {'type' => '_converted', 'text' => $reference} };
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see {reference_name}', $substrings);
+ $tree = $self->cdt('see {reference_name}', $substrings);
} elsif ($cmdname eq 'xref') {
- $tree = $self->gdt('See {reference_name}', $substrings);
+ $tree = $self->cdt('See {reference_name}', $substrings);
} elsif ($cmdname eq 'ref' or $cmdname eq 'link') {
- $tree = $self->gdt('{reference_name}', $substrings);
+ $tree = $self->cdt('{reference_name}', $substrings);
}
} else {
# external reference, including unknown node without file nor book
@@ -6124,61 +6124,61 @@ sub _convert_xref_commands($$$$)
=> {'type' => '_converted', 'text' => $reference},
'book' => {'type' => '_converted', 'text' => $book }};
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see {reference} in @cite{{book}}', $substrings);
+ $tree = $self->cdt('see {reference} in @cite{{book}}', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See {reference} in @cite{{book}}', $substrings);
+ $tree = $self->cdt('See {reference} in @cite{{book}}', $substrings);
} else { # @ref
- $tree = $self->gdt('{reference} in @cite{{book}}', $substrings);
+ $tree = $self->cdt('{reference} in @cite{{book}}', $substrings);
}
} elsif (defined($book_reference)) {
$substrings = { 'book_reference' => {'type' => '_converted',
'text' => $book_reference }};
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see @cite{{book_reference}}', $substrings);
+ $tree = $self->cdt('see @cite{{book_reference}}', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See @cite{{book_reference}}', $substrings);
+ $tree = $self->cdt('See @cite{{book_reference}}', $substrings);
} else { # @ref
- $tree = $self->gdt('@cite{{book_reference}}', $substrings);
+ $tree = $self->cdt('@cite{{book_reference}}', $substrings);
}
} elsif (defined($book) and defined($name)) {
$substrings = {
'section' => {'type' => '_converted', 'text' => $name},
'book' => {'type' => '_converted', 'text' => $book }};
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see `{section}\' in @cite{{book}}', $substrings);
+ $tree = $self->cdt('see `{section}\' in @cite{{book}}', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See `{section}\' in @cite{{book}}', $substrings);
+ $tree = $self->cdt('See `{section}\' in @cite{{book}}', $substrings);
} else { # @ref
- $tree = $self->gdt('`{section}\' in @cite{{book}}', $substrings);
+ $tree = $self->cdt('`{section}\' in @cite{{book}}', $substrings);
}
} elsif (defined($book)) { # should seldom or even never happen
$substrings = {'book' => {'type' => '_converted', 'text' => $book }};
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see @cite{{book}}', $substrings);
+ $tree = $self->cdt('see @cite{{book}}', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See @cite{{book}}', $substrings);
+ $tree = $self->cdt('See @cite{{book}}', $substrings);
} else { # @ref
- $tree = $self->gdt('@cite{{book}}', $substrings);
+ $tree = $self->cdt('@cite{{book}}', $substrings);
}
} elsif (defined($reference)) {
$substrings = { 'reference'
=> {'type' => '_converted', 'text' => $reference} };
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see {reference}', $substrings);
+ $tree = $self->cdt('see {reference}', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See {reference}', $substrings);
+ $tree = $self->cdt('See {reference}', $substrings);
} else { # @ref
- $tree = $self->gdt('{reference}', $substrings);
+ $tree = $self->cdt('{reference}', $substrings);
}
} elsif (defined($name)) {
$substrings = { 'section'
=> {'type' => '_converted', 'text' => $name} };
if ($cmdname eq 'pxref') {
- $tree = $self->gdt('see `{section}\'', $substrings);
+ $tree = $self->cdt('see `{section}\'', $substrings);
} elsif ($cmdname eq 'xref' or $cmdname eq 'inforef') {
- $tree = $self->gdt('See `{section}\'', $substrings);
+ $tree = $self->cdt('See `{section}\'', $substrings);
} else { # @ref
- $tree = $self->gdt('`{section}\'', $substrings);
+ $tree = $self->cdt('`{section}\'', $substrings);
}
}
@@ -6421,14 +6421,14 @@ sub _convert_printindex_command($$$$)
$result_tree
# TRANSLATORS: redirect to another index entry
# TRANSLATORS: @: is discardable and is used to avoid a msgfmt error
- = $self->gdt('@code{{main_index_entry}}, @emph{See@:}
@code{{seeentry}}',
+ = $self->cdt('@code{{main_index_entry}}, @emph{See@:}
@code{{seeentry}}',
{'main_index_entry' => $entry_tree,
'seeentry' => $referred_tree});
} else {
$result_tree
# TRANSLATORS: redirect to another index entry
# TRANSLATORS: @: is discardable and used to avoid a msgfmt error
- = $self->gdt('{main_index_entry}, @emph{See@:} {seeentry}',
+ = $self->cdt('{main_index_entry}, @emph{See@:} {seeentry}',
{'main_index_entry' => $entry_tree,
'seeentry' => $referred_tree});
}
@@ -6446,7 +6446,7 @@ sub _convert_printindex_command($$$$)
$section_class = "$cmdname-index-see-entry-section";
} else {
# TRANSLATORS: refer to another index entry
- my $reference_tree = $self->gdt('@emph{See also} {see_also_entry}',
+ my $reference_tree = $self->cdt('@emph{See also} {see_also_entry}',
{'see_also_entry' => $referred_tree});
my $conv_str_entry
= "index $index_name l $letter index entry $entry_nr (with seealso)";
@@ -6654,7 +6654,7 @@ sub _convert_printindex_command($$$$)
my $summary_header = $self->html_attribute_class('table',
["$index_name-letters-header-$cmdname"]).'><tr><th>'
# TRANSLATORS: before list of letters and symbols grouping index
entries
- . $self->convert_tree($self->gdt('Jump to')) .": $non_breaking_space
</th><td>" .
+ . $self->convert_tree($self->cdt('Jump to')) .": $non_breaking_space
</th><td>" .
$non_alpha_text . $join . $alpha_text . "</td></tr></table>\n";
$result .= $summary_header;
@@ -6666,10 +6666,10 @@ sub _convert_printindex_command($$$$)
." border=\"0\">\n" . '<tr><td></td>'
. $self->html_attribute_class('th', ["entries-header-$cmdname"]).'>'
# TRANSLATORS: index entries column header in index formatting
- . $self->convert_tree($self->gdt('Index Entry')) .'</th>'
+ . $self->convert_tree($self->cdt('Index Entry')) .'</th>'
. $self->html_attribute_class('th', ["sections-header-$cmdname"]).'>'
# TRANSLATORS: section of index entry column header in index formatting
- . $self->convert_tree($self->gdt('Section')) . "</th></tr>\n"
+ . $self->convert_tree($self->cdt('Section')) . "</th></tr>\n"
. "<tr><td colspan=\"3\">".$self->get_conf('DEFAULT_RULE')
."</td></tr>\n";
$result .= $result_index_entries;
@@ -6681,7 +6681,7 @@ sub _convert_printindex_command($$$$)
my $summary_footer = $self->html_attribute_class('table',
["$index_name-letters-footer-$cmdname"]).'><tr><th>'
# TRANSLATORS: before list of letters and symbols grouping index
entries
- . $self->convert_tree($self->gdt('Jump to'))
+ . $self->convert_tree($self->cdt('Jump to'))
. ": $non_breaking_space </th><td>"
. $non_alpha_text . $join . $alpha_text . "</td></tr></table>\n";
$result .= $summary_footer
@@ -6792,7 +6792,7 @@ sub _open_quotation_command($$$)
and $command->{'args'}->[0]->{'contents'}
and @{$command->{'args'}->[0]->{'contents'}}) {
$formatted_quotation_arg_to_prepend
- = $self->convert_tree($self->gdt('@b{{quotation_arg}:} ',
+ = $self->convert_tree($self->cdt('@b{{quotation_arg}:} ',
{'quotation_arg' => $command->{'args'}->[0]}),
"open $cmdname prepended arg");
}
@@ -7673,15 +7673,15 @@ sub _convert_def_line_type($$$$)
if ($base_command_name eq 'deftypeop'
and $type_element
and $self->get_conf('deftypefnnewline') eq 'on') {
- $category_tree = $self->gdt('{category} on @code{{class}}:@* ',
+ $category_tree = $self->cdt('{category} on @code{{class}}:@* ',
$substrings);
} elsif ($base_command_name eq 'defop'
or $base_command_name eq 'deftypeop') {
- $category_tree = $self->gdt('{category} on @code{{class}}: ',
+ $category_tree = $self->cdt('{category} on @code{{class}}: ',
$substrings);
} elsif ($base_command_name eq 'defcv'
or $base_command_name eq 'deftypecv') {
- $category_tree = $self->gdt('{category} of @code{{class}}: ',
+ $category_tree = $self->cdt('{category} of @code{{class}}: ',
$substrings);
}
} else {
@@ -7697,9 +7697,9 @@ sub _convert_def_line_type($$$$)
# an explicit <br> in that case. Probably requires changing
# the conversion of @* in a @def* line in preformatted, nothing
# really specific of @deftypefnnewline on.
- $category_tree = $self->gdt('{category}:@* ', $substrings);
+ $category_tree = $self->cdt('{category}:@* ', $substrings);
} else {
- $category_tree = $self->gdt('{category}: ', $substrings);
+ $category_tree = $self->cdt('{category}: ', $substrings);
}
}
if ($category_tree) {
@@ -10793,13 +10793,13 @@ sub _default_format_program_string($)
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
return $self->convert_tree(
- $self->gdt('This document was generated on @emph{@today{}} using
@uref{{program_homepage}, @emph{{program}}}.',
+ $self->cdt('This document was generated on @emph{@today{}} using
@uref{{program_homepage}, @emph{{program}}}.',
{ 'program_homepage' => {'text'
=> $self->get_conf('PACKAGE_URL')},
'program' => {'text' => $self->get_conf('PROGRAM')} }));
} else {
return $self->convert_tree(
- $self->gdt('This document was generated on @emph{@today{}}.'));
+ $self->cdt('This document was generated on @emph{@today{}}.'));
}
}
@@ -10841,7 +10841,7 @@ sub _default_format_end_file($$$)
and ($js_setting eq 'generate' or $js_setting eq 'reference')) {
$result .=
'<a href="'.$self->url_protect_url_text($js_path).'"
rel="jslicense"><small>'
- .$self->convert_tree($self->gdt('JavaScript license information'))
+ .$self->convert_tree($self->cdt('JavaScript license information'))
.'</small></a>';
}
}
@@ -10888,7 +10888,7 @@ sub _file_header_information($$;$)
$element_tree = $self->command_tree($command);
}
# TRANSLATORS: sectioning element title for the page header
- my $title_tree = $self->gdt('{element_text} ({title})',
+ my $title_tree = $self->cdt('{element_text} ({title})',
{ 'title' => $self->get_info('title_tree'),
'element_text' => $element_tree });
$title = $self->convert_tree_new_formatting_context(
@@ -11102,7 +11102,7 @@ sub _default_format_node_redirection_page($$;$)
my $href = $self->command_href($command, $filename);
my $direction = "<a href=\"$href\">$name</a>";
my $string = $self->convert_tree(
- $self->gdt('The node you are looking for is at {href}.',
+ $self->cdt('The node you are looking for is at {href}.',
{ 'href' => {'type' => '_converted', 'text' => $direction }}));
my ($title, $description, $encoding, $date, $css_lines,
@@ -11227,7 +11227,7 @@ sub _default_format_special_body_about($$$)
}
$about .= "<p>\n";
$about .= $self->convert_tree(
- $self->gdt(' The buttons in the navigation panels have the following
meaning:'))
+ $self->cdt(' The buttons in the navigation panels have the following
meaning:'))
. "\n";
$about .= <<EOT;
</p>
@@ -11235,13 +11235,13 @@ sub _default_format_special_body_about($$$)
<tr>
EOT
# TRANSLATORS: direction column header in the navigation help
- $about .= ' <th> ' . $self->convert_tree($self->gdt('Button')) . "
</th>\n" .
+ $about .= ' <th> ' . $self->convert_tree($self->cdt('Button')) . "
</th>\n" .
# TRANSLATORS: button label column header in the navigation help
- ' <th> ' . $self->convert_tree($self->gdt('Name')) . " </th>\n" .
+ ' <th> ' . $self->convert_tree($self->cdt('Name')) . " </th>\n" .
# TRANSLATORS: direction description column header in the navigation help
- ' <th> ' . $self->convert_tree($self->gdt('Go to')) . " </th>\n" .
+ ' <th> ' . $self->convert_tree($self->cdt('Go to')) . " </th>\n" .
# TRANSLATORS: section reached column header in the navigation help
- ' <th> ' . $self->convert_tree($self->gdt('From 1.2.3 go to')) .
"</th>\n"
+ ' <th> ' . $self->convert_tree($self->cdt('From 1.2.3 go to')) .
"</th>\n"
. " </tr>\n";
my $active_icons;
@@ -11290,7 +11290,7 @@ EOT
<p>
EOT
- $about .= $self->convert_tree($self->gdt(' where the @strong{ Example }
assumes that the current position is at @strong{ Subsubsection One-Two-Three }
of a document of the following structure:')) . "\n";
+ $about .= $self->convert_tree($self->cdt(' where the @strong{ Example }
assumes that the current position is at @strong{ Subsubsection One-Two-Three }
of a document of the following structure:')) . "\n";
# where the <strong> Example </strong> assumes that the current position
# is at <strong> Subsubsection One-Two-Three </strong> of a document of
@@ -11302,10 +11302,10 @@ EOT
EOT
my $non_breaking_space = $self->get_info('non_breaking_space');
# TRANSLATORS: example name of section for section 1
- $about .= ' <li> 1. ' . $self->convert_tree($self->gdt('Section One')) .
"\n" .
+ $about .= ' <li> 1. ' . $self->convert_tree($self->cdt('Section One')) .
"\n" .
" <ul>\n" .
# TRANSLATORS: example name of section for section 1.1
-' <li>1.1 ' . $self->convert_tree($self->gdt('Subsection One-One')) .
"\n";
+' <li>1.1 ' . $self->convert_tree($self->cdt('Subsection One-One')) .
"\n";
$about .= <<EOT;
<ul>
<li>...</li>
@@ -11313,23 +11313,23 @@ EOT
</li>
EOT
# TRANSLATORS: example name of section for section 1.2
- $about .= ' <li>1.2 ' . $self->convert_tree($self->gdt('Subsection
One-Two')) . "\n" .
+ $about .= ' <li>1.2 ' . $self->convert_tree($self->cdt('Subsection
One-Two')) . "\n" .
" <ul>\n" .
# TRANSLATORS: example name of section for section 1.2.1
-' <li>1.2.1 ' . $self->convert_tree($self->gdt('Subsubsection
One-Two-One')) . "</li>\n" .
+' <li>1.2.1 ' . $self->convert_tree($self->cdt('Subsubsection
One-Two-One')) . "</li>\n" .
# TRANSLATORS: example name of section for section 1.2.2
-' <li>1.2.2 ' . $self->convert_tree($self->gdt('Subsubsection
One-Two-Two')) . "</li>\n" .
+' <li>1.2.2 ' . $self->convert_tree($self->cdt('Subsubsection
One-Two-Two')) . "</li>\n" .
# TRANSLATORS: example name of section for section 1.2.3
-' <li>1.2.3 ' . $self->convert_tree($self->gdt('Subsubsection
One-Two-Three'))
+' <li>1.2.3 ' . $self->convert_tree($self->cdt('Subsubsection
One-Two-Three'))
. " $non_breaking_space $non_breaking_space\n"
.
-' <strong><== ' . $self->convert_tree($self->gdt('Current
Position')) . " </strong></li>\n" .
+' <strong><== ' . $self->convert_tree($self->cdt('Current
Position')) . " </strong></li>\n" .
# TRANSLATORS: example name of section for section 1.2.4
-' <li>1.2.4 ' . $self->convert_tree($self->gdt('Subsubsection
One-Two-Four')) . "</li>\n" .
+' <li>1.2.4 ' . $self->convert_tree($self->cdt('Subsubsection
One-Two-Four')) . "</li>\n" .
" </ul>\n" .
" </li>\n" .
# TRANSLATORS: example name of section for section 1.3
-' <li>1.3 ' . $self->convert_tree($self->gdt('Subsection One-Three')) .
"\n";
+' <li>1.3 ' . $self->convert_tree($self->cdt('Subsection One-Three')) .
"\n";
$about .= <<EOT;
<ul>
<li>...</li>
@@ -11337,7 +11337,7 @@ EOT
</li>
EOT
# TRANSLATORS: example name of section for section 1.4
- $about .= ' <li>1.4 ' . $self->convert_tree($self->gdt('Subsection
One-Four')) . "</li>\n";
+ $about .= ' <li>1.4 ' . $self->convert_tree($self->cdt('Subsection
One-Four')) . "</li>\n";
$about .= <<EOT;
</ul>
@@ -12202,7 +12202,7 @@ sub _prepare_converted_output_info($)
}
}
if (!defined($html_title_string)) {
- my $default_title = $self->gdt('Untitled Document');
+ my $default_title = $self->cdt('Untitled Document');
$self->{'title_tree'} = $default_title;
$self->{'title_string'} = $self->convert_tree_new_formatting_context(
{'type' => '_string', 'contents' => [$self->{'title_tree'}]},
@@ -13087,10 +13087,10 @@ sub _convert($$;$)
my $translated;
if ($element->{'extra'}
and $element->{'extra'}->{'translation_context'}) {
- $translated = $self->pgdt($element->{'extra'}->{'translation_context'},
+ $translated = $self->pcdt($element->{'extra'}->{'translation_context'},
$element->{'text'});
} else {
- $translated = $self->gdt($element->{'text'});
+ $translated = $self->cdt($element->{'text'});
}
$result = $self->_convert($translated, 'translated TEXT');
} else {
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 09a4fb6c3d..b0a2ae524f 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -2715,10 +2715,10 @@ sub _convert($$)
my $tree;
if ($element->{'extra'}
and $element->{'extra'}->{'translation_context'}) {
- $tree = $self->pgdt($element->{'extra'}->{'translation_context'},
+ $tree = $self->pcdt($element->{'extra'}->{'translation_context'},
$element->{'text'});
} else {
- $tree = $self->gdt($element->{'text'});
+ $tree = $self->cdt($element->{'text'});
}
my $converted = _convert($self, $tree);
return $converted;
@@ -3166,7 +3166,7 @@ sub _convert($$)
and $element->{'args'}->[1]->{'contents'}
and @{$element->{'args'}->[1]->{'contents'}}) {
my $description = _convert($self, $element->{'args'}->[1]);
- my $text = $self->gdt_string('{text} ({url})',
+ my $text = $self->cdt_string('{text} ({url})',
{'text' => $description, 'url' => "\\nolinkurl{$url_text}"});
$result .= "\\href{$url_text}{$text}";
return $result;
@@ -3494,7 +3494,7 @@ sub _convert($$)
and $element->{'args'}->[-1]->{'contents'}
and @{$element->{'args'}->[-1]->{'contents'}}) {
my $prepended
- = $self->gdt('{abbr_or_acronym} ({explanation})',
+ = $self->cdt('{abbr_or_acronym} ({explanation})',
{'abbr_or_acronym' => $argument,
'explanation'
=> $element->{'args'}->[-1]});
@@ -3646,7 +3646,7 @@ sub _convert($$)
}
return $result;
} elsif ($cmdname eq 'value') {
- my $expansion = $self->gdt('@{No value for `{value}\'@}',
+ my $expansion = $self->cdt('@{No value for `{value}\'@}',
{'value'
=> $element->{'args'}->[0]});
$expansion = {'type' => 'paragraph',
@@ -3705,7 +3705,7 @@ sub _convert($$)
if ($element->{'args'} and $element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}
and @{$element->{'args'}->[0]->{'contents'}}) {
- my $prepended = $self->gdt('@b{{quotation_arg}:} ',
+ my $prepended = $self->cdt('@b{{quotation_arg}:} ',
{'quotation_arg' => $element->{'args'}->[0]});
$result .= $self->_convert($prepended);
}
@@ -4429,7 +4429,7 @@ sub _convert($$)
if ($author->{'args'}->[0]->{'contents'}) {
$result .= _convert($self,
# TRANSLATORS: quotation author
- $self->gdt('@center --- @emph{{author}}',
+ $self->cdt('@center --- @emph{{author}}',
{'author' => $author->{'args'}->[0]}));
}
}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index a08248a867..17ff8236c2 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -77,7 +77,7 @@ my %brace_commands = %Texinfo::Commands::brace_commands;
my $NO_NUMBER_FOOTNOTE_SYMBOL = '*';
-# documentlanguage is used through gdt().
+# documentlanguage is used through cdt().
my @informative_global_commands = ('paragraphindent', 'firstparagraphindent',
'frenchspacing', 'footnotestyle', 'documentlanguage', 'deftypefnnewline');
@@ -1390,12 +1390,12 @@ sub format_contents($$$)
or !defined($self->get_conf('NUMBER_SECTIONS')))) {
if ($section->{'cmdname'} eq 'appendix'
and $section->{'extra'}->{'section_level'} == 1) {
- $section_title_tree = $self->gdt('Appendix {number} {section_title}',
+ $section_title_tree = $self->cdt('Appendix {number} {section_title}',
{'number' => {'text'
=> $section->{'extra'}->{'section_number'}},
'section_title' => $section->{'args'}->[0]});
} else {
- $section_title_tree = $self->gdt('{number} {section_title}',
+ $section_title_tree = $self->cdt('{number} {section_title}',
{'number' => {'text'
=> $section->{'extra'}->{'section_number'}},
'section_title' => $section->{'args'}->[0]});
@@ -1682,7 +1682,7 @@ sub process_printindex($$;$)
# cache the transformation to text and byte counting, as
# it is likely that there is more than one such entry
if (!$self->{'outside_of_any_node_text'}) {
- my $tree = $self->gdt('(outside of any node)');
+ my $tree = $self->cdt('(outside of any node)');
my ($node_text, $width)
= $self->convert_line_new_context($tree);
$self->{'outside_of_any_node_text'} = $node_text;
@@ -1865,11 +1865,11 @@ sub _text_heading($$$;$$)
if (defined($number)) {
if ($current->{'cmdname'} eq 'appendix'
and $current->{'extra'}->{'section_level'} == 1) {
- $text = $self->gdt_string(
+ $text = $self->cdt_string(
'Appendix {number} {section_title}',
{'number' => $number, 'section_title' => $heading});
} else {
- $text = $self->gdt_string(
+ $text = $self->cdt_string(
'{number} {section_title}',
{'number' => $number, 'section_title' => $heading});
}
@@ -2062,10 +2062,10 @@ sub _convert($$)
my $tree;
if ($element->{'extra'}
and $element->{'extra'}->{'translation_context'}) {
- $tree = $self->pgdt($element->{'extra'}->{'translation_context'},
+ $tree = $self->pcdt($element->{'extra'}->{'translation_context'},
$element->{'text'});
} else {
- $tree = $self->gdt($element->{'text'});
+ $tree = $self->cdt($element->{'text'});
}
_convert($self, $tree);
return;
@@ -2651,10 +2651,10 @@ sub _convert($$)
}
my $email_tree;
if ($name and $email) {
- $email_tree = $self->gdt('{name} @url{{email}}',
+ $email_tree = $self->cdt('{name} @url{{email}}',
{'name' => $name, 'email' => $email});
} elsif ($email) {
- $email_tree = $self->gdt('@url{{email}}',
+ $email_tree = $self->cdt('@url{{email}}',
{'email' => $email});
} elsif ($name) {
$email_tree = $name;
@@ -2685,11 +2685,11 @@ sub _convert($$)
and defined($element->{'args'}->[1])
and $element->{'args'}->[1]->{'contents'}
and @{$element->{'args'}->[1]->{'contents'}}) {
- $inserted = $self->gdt('{text} ({url})',
+ $inserted = $self->cdt('{text} ({url})',
{'text' => $element->{'args'}->[1],
'url' => $url });
} else {
- $inserted = $self->gdt('@t{<{url}>}', {'url' => $url});
+ $inserted = $self->cdt('@t{<{url}>}', {'url' => $url});
}
} elsif (scalar(@{$element->{'args'}}) == 2
and defined($element->{'args'}->[1])
@@ -2760,7 +2760,7 @@ sub _convert($$)
and defined($element->{'args'}->[-1])
and $element->{'args'}->[-1]->{'contents'}
and @{$element->{'args'}->[-1]->{'contents'}}) {
- my $inserted = $self->gdt('{abbr_or_acronym} ({explanation})',
+ my $inserted = $self->cdt('{abbr_or_acronym} ({explanation})',
{'abbr_or_acronym' => $argument,
'explanation' => $element->{'args'}->[-1]});
_convert($self, $inserted);
@@ -2854,7 +2854,7 @@ sub _convert($$)
}
return;
} elsif ($command eq 'value') {
- my $expansion = $self->gdt('@{No value for `{value}\'@}',
+ my $expansion = $self->cdt('@{No value for `{value}\'@}',
{'value' => $element->{'args'}->[0]});
my $piece;
if ($formatter->{'_top_formatter'}) {
@@ -2967,7 +2967,7 @@ sub _convert($$)
if ($element->{'args'} and $element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}
and scalar(@{$element->{'args'}->[0]->{'contents'}})) {
- my $prepended = $self->gdt('@b{{quotation_arg}:} ',
+ my $prepended = $self->cdt('@b{{quotation_arg}:} ',
{'quotation_arg' => $element->{'args'}->[0]});
$prepended->{'type'} = 'frenchspacing';
#_convert($self, $prepended);
@@ -3018,7 +3018,7 @@ sub _convert($$)
and @{$element->{'args'}->[0]->{'contents'}}) {
# FIXME reset the paragraph count in cartouche and use a
# specific format_context?
- my $prepended = $self->gdt('@center @b{{cartouche_arg}}',
+ my $prepended = $self->cdt('@center @b{{cartouche_arg}}',
{'cartouche_arg' => $element->{'args'}->[0]});
$prepended->{'type'} = 'frenchspacing';
# Do not consider the title to be like a paragraph
@@ -3448,14 +3448,14 @@ sub _convert($$)
'name' => $name,
'arguments' => $arguments};
if ($omit_def_space) {
- $tree = $self->gdt('@tie{}-- {category}: {name}{arguments}',
+ $tree = $self->cdt('@tie{}-- {category}: {name}{arguments}',
$strings);
} else {
- $tree = $self->gdt('@tie{}-- {category}: {name} {arguments}',
+ $tree = $self->cdt('@tie{}-- {category}: {name} {arguments}',
$strings);
}
} else {
- $tree = $self->gdt('@tie{}-- {category}: {name}', {
+ $tree = $self->cdt('@tie{}-- {category}: {name}', {
'category' => $category,
'name' => $name});
}
@@ -3472,21 +3472,21 @@ sub _convert($$)
and $command eq 'deftypefn') {
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}--
{category}:@*{type}@*{name}{arguments}',
+ = $self->cdt('@tie{}--
{category}:@*{type}@*{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category}:@*{type}@*{name}
{arguments}',
+ = $self->cdt('@tie{}-- {category}:@*{type}@*{name}
{arguments}',
$strings);
}
} else {
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category}: {type} {name}{arguments}',
+ = $self->cdt('@tie{}-- {category}: {type} {name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category}: {type} {name}
{arguments}',
+ = $self->cdt('@tie{}-- {category}: {type} {name}
{arguments}',
$strings);
}
}
@@ -3497,10 +3497,10 @@ sub _convert($$)
'name' => $name};
if ($self->get_conf('deftypefnnewline') eq 'on'
and $command eq 'deftypefn') {
- $tree = $self->gdt('@tie{}-- {category}:@*{type}@*{name}',
+ $tree = $self->cdt('@tie{}-- {category}:@*{type}@*{name}',
$strings);
} else {
- $tree = $self->gdt('@tie{}-- {category}: {type} {name}',
+ $tree = $self->cdt('@tie{}-- {category}: {type} {name}',
$strings);
}
}
@@ -3515,15 +3515,15 @@ sub _convert($$)
'arguments' => $arguments};
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category} of {class}:
{name}{arguments}',
+ = $self->cdt('@tie{}-- {category} of {class}:
{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} of {class}: {name}
{arguments}',
+ = $self->cdt('@tie{}-- {category} of {class}: {name}
{arguments}',
$strings);
}
} else {
- $tree = $self->gdt('@tie{}-- {category} of {class}: {name}', {
+ $tree = $self->cdt('@tie{}-- {category} of {class}: {name}', {
'category' => $category,
'class' => $class,
'name' => $name});
@@ -3539,15 +3539,15 @@ sub _convert($$)
'arguments' => $arguments};
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category} on {class}:
{name}{arguments}',
+ = $self->cdt('@tie{}-- {category} on {class}:
{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} on {class}: {name}
{arguments}',
+ = $self->cdt('@tie{}-- {category} on {class}: {name}
{arguments}',
$strings);
}
} else {
- $tree = $self->gdt('@tie{}-- {category} on {class}: {name}', {
+ $tree = $self->cdt('@tie{}-- {category} on {class}: {name}', {
'category' => $category,
'class' => $class,
'name' => $name});
@@ -3563,21 +3563,21 @@ sub _convert($$)
if ($self->get_conf('deftypefnnewline') eq 'on') {
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category} on
{class}:@*{type}@*{name}{arguments}',
+ = $self->cdt('@tie{}-- {category} on
{class}:@*{type}@*{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} on
{class}:@*{type}@*{name} {arguments}',
+ = $self->cdt('@tie{}-- {category} on
{class}:@*{type}@*{name} {arguments}',
$strings);
}
} else {
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category} on {class}: {type}
{name}{arguments}',
+ = $self->cdt('@tie{}-- {category} on {class}: {type}
{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} on {class}: {type} {name}
{arguments}',
+ = $self->cdt('@tie{}-- {category} on {class}: {type} {name}
{arguments}',
$strings);
}
}
@@ -3589,11 +3589,11 @@ sub _convert($$)
'name' => $name};
if ($self->get_conf('deftypefnnewline') eq 'on') {
$tree
- = $self->gdt('@tie{}-- {category} on {class}:@*{type}@*{name}',
+ = $self->cdt('@tie{}-- {category} on {class}:@*{type}@*{name}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} on {class}: {type} {name}',
+ = $self->cdt('@tie{}-- {category} on {class}: {type} {name}',
$strings);
}
}
@@ -3607,11 +3607,11 @@ sub _convert($$)
'arguments' => $arguments};
if ($omit_def_space) {
$tree
- = $self->gdt('@tie{}-- {category} of {class}: {type}
{name}{arguments}',
+ = $self->cdt('@tie{}-- {category} of {class}: {type}
{name}{arguments}',
$strings);
} else {
$tree
- = $self->gdt('@tie{}-- {category} of {class}: {type} {name}
{arguments}',
+ = $self->cdt('@tie{}-- {category} of {class}: {type} {name}
{arguments}',
$strings);
}
} else {
@@ -3621,7 +3621,7 @@ sub _convert($$)
'class' => $class,
'name' => $name};
$tree
- = $self->gdt('@tie{}-- {category} of {class}: {type} {name}',
+ = $self->cdt('@tie{}-- {category} of {class}: {type} {name}',
$strings);
}
}
@@ -4101,7 +4101,7 @@ sub _convert($$)
and $author->{'args'}->[0]->{'contents'}) {
_convert($self,
# TRANSLATORS: quotation author
- $self->gdt("\@center --- \@emph{{author}}",
+ $self->cdt("\@center --- \@emph{{author}}",
{'author' => $author->{'args'}->[0]}));
}
}
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index e10b62242a..4a81c30a02 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -553,16 +553,16 @@ sub _convert($$)
# at the place of the tree, but the converter may want to use
# another documentlanguage, for instance the documentlanguage at
# the end of the preamble, so we let the converter set it.
- #my $tree = $options->{'converter'}->gdt($element->{'text'}, undef,
+ #my $tree = Texinfo::Translations::gdt(undef, $element->{'text'},
# undef, $element->{'extra'}->{'documentlanguage'});
my $tree;
if ($element->{'extra'}
and $element->{'extra'}->{'translation_context'}) {
- $tree = $options->{'converter'}->pgdt(
+ $tree = $options->{'converter'}->pcdt(
$element->{'extra'}->{'translation_context'},
$element->{'text'});
} else {
- $tree = $options->{'converter'}->gdt($element->{'text'});
+ $tree = $options->{'converter'}->cdt($element->{'text'});
}
$result = _convert($options, $tree);
} else {
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 03fa74e600..dab04a176a 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -183,7 +183,7 @@ sub definition_category_tree($$)
if ($self) {
# TRANSLATORS: association of a method or operation name with a class
# in descriptions of object-oriented programming methods or operations.
- return $self->gdt('{category} on @code{{class}}',
+ return $self->cdt('{category} on @code{{class}}',
{'category' => $arg_category,
'class' => $arg_class});
} else {
@@ -201,7 +201,7 @@ sub definition_category_tree($$)
# TRANSLATORS: association of a variable or instance variable with
# a class in descriptions of object-oriented programming variables
# or instance variable.
- return $self->gdt('{category} of @code{{class}}', { 'category' =>
$arg_category,
+ return $self->cdt('{category} of @code{{class}}', { 'category' =>
$arg_category,
'class' => $arg_class });
} else {
my $result = {};
@@ -357,10 +357,10 @@ sub add_heading_number($$$;$)
if (defined($number)) {
if ($current->{'cmdname'} eq 'appendix'
and $current->{'extra'}->{'section_level'} == 1) {
- $result = $self->gdt_string('Appendix {number} {section_title}',
+ $result = $self->cdt_string('Appendix {number} {section_title}',
{'number' => $number, 'section_title' => $text});
} else {
- $result = $self->gdt_string('{number} {section_title}',
+ $result = $self->cdt_string('{number} {section_title}',
{'number' => $number, 'section_title' => $text});
}
} else {
@@ -538,7 +538,7 @@ sub translated_command_tree($$)
my $cmdname = shift;
if ($self->{'translated_commands'}
and $self->{'translated_commands'}->{$cmdname}) {
- return $self->gdt($self->{'translated_commands'}->{$cmdname});
+ return $self->cdt($self->{'translated_commands'}->{$cmdname});
}
return undef;
}
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 51e28a9b20..c08be91357 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1465,7 +1465,8 @@ sub new_master_menu($$$;$)
my $first_preformatted =
$master_menu->{'contents'}->[0]->{'contents'}->[0];
my $master_menu_title
= Texinfo::Translations::gdt($customization_information,
- ' --- The Detailed Node Listing ---');
+ ' --- The Detailed Node Listing ---',
+ $customization_information->get_conf('documentlanguage'));
my @master_menu_title_contents;
foreach my $content (@{$master_menu_title->{'contents'}}, {'text' =>
"\n"}) {
$content->{'parent'} = $first_preformatted;
@@ -1593,8 +1594,8 @@ sub _print_down_menus($$;$)
if (0) {
# it is needed to mark the translation as gdt is called like
- # Texinfo::Translations::gdt($customization_information, ' --- The Detailed
Node Listing ---')
- # and not like gdt(' --- The Detailed Node Listing ---')
+ # gdt($customization_information, ' --- The Detailed Node Listing ---', ...)
+ # and not like gdt(' --- The Detailed Node Listing ---', ...)
gdt(' --- The Detailed Node Listing ---');
}
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index f5deeb1448..9f98233b29 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -74,9 +74,6 @@ sub import {
my $DEFAULT_LANGUAGE = 'en';
-my $DEFAULT_ENCODING = 'utf-8';
-#my $DEFAULT_PERL_ENCODING = 'utf-8';
-
my $messages_textdomain = 'texinfo';
my $strings_textdomain = 'texinfo_document';
@@ -141,32 +138,21 @@ sub _switch_messages_locale
# Get document translation - handle translations of in-document strings.
# Return a parsed Texinfo tree
-# $LANG set the language if set, otherwise the documentlanguage configuration
-# variable is used; if still undef, the $DEFAULT_LANGUAGE variable is used.
-# NOTE whether documentlanguage is set as a configuration variable depends a
-# lot on the caller.
-# * If called from a Parser, or from the main program, documentlanguage is in
-# general not set, except if set from the command line.
-# When called from the parser, however, it should only be for @def* object
-# oriented def* index name translation and $LANG is likely to be set from
the
-# tree if there was a @documentlanguage.
-# * If called from a converter, documentlanguage will in general be set from
-# the document when it is encountered. Before the first @documentlanguage,
-# it depends on the converter. Some do not set @documentlanguage before it
-# is encountered. Some set some default based on @documentlanguage if in
-# the preamble, some set some default language (in general en) in any
-# case.
+# $LANG set the language if set. If undef, the $DEFAULT_LANGUAGE variable
+# is used.
+# NOTE If called from a converter, $LANG will in general be set from the
+# document documentlanguage when it is encountered. Before the first
+# @documentlanguage, it depends on the converter. Some do not set
+# @documentlanguage before it is encountered. Some set some default
+# based on @documentlanguage if in the preamble, some set some default
+# language (in general en) in any case.
+# TODO redefined in HTML. Document?
sub translate_string($$;$$)
{
- my ($customization_information, $string, $translation_context, $lang) = @_;
+ my ($customization_information, $string, $lang, $translation_context) = @_;
if (ref($customization_information) eq 'Texinfo::Document') {
cluck;
}
- # In addition to being settable from the command line,
- # the language needs to be dynamic in case there is an untranslated string
- # from another language that needs to be translated.
- $lang = $customization_information->get_conf('documentlanguage')
- if ($customization_information and !defined($lang));
if (defined($lang) and $lang eq '') {
cluck ("BUG: defined but empty documentlanguage:
$customization_information: '$string'\n");
}
@@ -245,8 +231,8 @@ sub translate_string($$;$$)
# Return a parsed Texinfo tree
sub gdt($$;$$$)
{
- my ($customization_information, $string, $replaced_substrings,
- $translation_context, $lang) = @_;
+ my ($customization_information, $string, $lang, $replaced_substrings,
+ $translation_context) = @_;
# allows to redefine translate_string, as done in the HTML converter. Cannot
# directly call translate_string on $customization_information, as it may not
@@ -256,7 +242,7 @@ sub gdt($$;$$$)
= $customization_information->can('translate_string');
$translate_string_method = \&translate_string if (!$translate_string_method);
my $translated_string = &$translate_string_method($customization_information,
- $string, $translation_context, $lang);
+ $string, $lang, $translation_context);
my $result_tree = replace_convert_substrings($customization_information,
$translated_string,
@@ -271,8 +257,8 @@ sub gdt($$;$$$)
# a Texinfo tree.
sub gdt_string($$;$$$)
{
- my ($customization_information, $string, $replaced_substrings,
- $translation_context, $lang) = @_;
+ my ($customization_information, $string, $lang, $replaced_substrings,
+ $translation_context) = @_;
# Following code allows to redefine translate_string, as done in the HTML
# converter. We check with can() explicitely instead of letting inheritance
@@ -285,7 +271,7 @@ sub gdt_string($$;$$$)
$translate_string_method = \&translate_string if (!$translate_string_method);
my $translated_string = &$translate_string_method($customization_information,
- $string, $translation_context, $lang);
+ $string, $lang, $translation_context);
return replace_substrings ($customization_information, $translated_string,
$replaced_substrings);
@@ -410,9 +396,9 @@ sub _substitute($$) {
sub pgdt($$$;$$)
{
my ($customization_information, $translation_context, $string,
- $replaced_substrings, $lang) = @_;
- return $customization_information->gdt($string, $replaced_substrings,
- $translation_context, $lang);
+ $lang, $replaced_substrings) = @_;
+ return $customization_information->gdt($string, $lang, $replaced_substrings,
+ $translation_context);
}
if (0) {
@@ -477,8 +463,8 @@ sub complete_indices($$)
or $def_command eq 'defmethod'
or $def_command eq 'deftypemethod') {
$index_entry = gdt($customization_information, '{name} on {class}',
- {'name' => $name_copy, 'class' => $class_copy},
- undef, $entry_language);
+ $entry_language,
+ {'name' => $name_copy, 'class' => $class_copy});
$text_element = {'text' => ' on ',
'parent' => $index_entry_normalized};
} elsif ($def_command eq 'defcv'
@@ -486,8 +472,8 @@ sub complete_indices($$)
or $def_command eq 'deftypeivar'
or $def_command eq 'deftypecv') {
$index_entry = gdt($customization_information, '{name} of {class}',
- {'name' => $name_copy, 'class' => $class_copy},
- undef, $entry_language);
+ $entry_language,
+ {'name' => $name_copy, 'class' => $class_copy});
$text_element = {'text' => ' of ',
'parent' => $index_entry_normalized};
}
@@ -525,6 +511,7 @@ Texinfo::Translations - Translations of output documents
strings for Texinfo mod
Texinfo::Translations::configure('LocaleData');
my $tree_translated = $converter->gdt('See {reference} in @cite{{book}}',
+ $converter->get_conf('documentlanguage'),
{'reference' => $tree_reference,
'book' => {'text' => $book_name}});
@@ -566,17 +553,11 @@ The C<gdt> and C<pgdt> methods are used to translate
strings to be output in
converted documents, and return a Texinfo tree. The C<gdt_string> is similar
but returns a simple string, for already converted strings.
-The C<replace_convert_substrings> method is called by C<gdt> to substitute
-replaced substrings in a translated string and convert to a Texinfo tree.
-It may be especially useful when overriding or reimplementing C<gdt>. The
-C<replace_substrings> method is called by C<gdt_string> to substitute
-replaced substrings in a translated string.
-
=over
-=item $tree = $object->gdt($string, $replaced_substrings,
$translation_context, $lang)
+=item $tree = $object->gdt($string, $lang, $replaced_substrings,
$translation_context)
-=item $string = $object->gdt_string($string, $replaced_substrings,
$translation_context, $lang)
+=item $string = $object->gdt_string($string, $lang, $replaced_substrings,
$translation_context)
X<C<gdt>> X<C<gdt_string>>
@@ -585,6 +566,8 @@ the function returns a Texinfo tree, as the string is
interpreted
as Texinfo code after translation. With C<gdt_string> a string
is returned.
+I<$lang> is the language used for the translation.
+
I<$replaced_substrings> is an optional hash reference specifying
some substitution to be done after the translation. The key of the
I<$replaced_substrings> hash reference identifies what is to be substituted.
@@ -596,13 +579,11 @@ is replaced in the resulting string.
The I<$object> is typically a converter, but can be any object that implements
C<get_conf>, or undefined (C<undef>). If not undefined, the information in the
-I<$object> is used to determine the encoding, the documentlanguage and get some
-customization information.
+I<$object> is used to get some customization information.
The I<$translation_context> is optional. If not C<undef> this is a translation
context string for I<$string>. It is the first argument of C<pgettext>
-in the C API of Gettext. I<$lang> is optional. If set, it overrides the
-documentlanguage.
+in the C API of Gettext.
For example, in the following call, the string
C<See {reference} in @cite{{book}}> is translated, then
@@ -611,13 +592,14 @@ I<$tree_reference> in the resulting tree, and I<{book}>
replaced by the associated texinfo tree text element:
$tree = $converter->gdt('See {reference} in @cite{{book}}',
+ $converter->get_conf('documentlanguage'),
{'reference' => $tree_reference,
'book' => {'text' => $book_name}});
C<gdt> uses a gettext-like infrastructure to retrieve the
translated strings, using the I<texinfo_document> domain.
-=item $tree = $object->pgdt($translation_context, $string,
$replaced_substrings, $lang)
+=item $tree = $object->pgdt($translation_context, $string, $lang,
$replaced_substrings)
X<C<pgdt>>
Same to C<gdt> except that the I<$translation_context> is not optional.
@@ -625,6 +607,17 @@ Calls C<gdt>. This function is useful to mark strings
with a
translation context for translation. This function is similar to pgettext
in the Gettext C API.
+=back
+
+=begin comment
+
+The C<replace_convert_substrings> method is called by C<gdt> to substitute
+replaced substrings in a translated string and convert to a Texinfo tree.
+The C<replace_substrings> method is called by C<gdt_string> to substitute
+replaced substrings in a translated string.
+
+=over
+
=item $tree = $object->replace_convert_substrings($translated_string,
$replaced_substrings)
=item $string = $object->replace_substrings($translated_string,
$replaced_substrings)
@@ -647,6 +640,8 @@ translated string.
=back
+=end comment
+
=head1 SEE ALSO
L<GNU gettext utilities manual|https://www.gnu.org/software/gettext/manual/>.
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index 103cb9e0ed..ea829a23ea 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -677,7 +677,7 @@ EOT
return 1;
}
my $table_of_content_str = _epub_convert_tree_to_text($self,
- $self->gdt('Table of contents'));
+ $self->cdt('Table of contents'));
my $nav_file_title = $title.' - '.$table_of_content_str;
print $nav_fh <<EOT;
<?xml version="1.0" encoding="utf-8"?>
diff --git a/tp/init/html32.pm b/tp/init/html32.pm
index 5b304d0393..2627b298f1 100644
--- a/tp/init/html32.pm
+++ b/tp/init/html32.pm
@@ -190,7 +190,7 @@ sub html32_convert_explained_command($$$$)
my $result;
if ($with_explanation) {
- $result = $self->convert_tree($self->gdt('{explained_string}
({explanation})',
+ $result = $self->convert_tree($self->cdt('{explained_string}
({explanation})',
{'explained_string' => $args->[0]->{'tree'},
'explanation' => $args->[1]->{'tree'} }));
} else {
diff --git a/tp/t/init/mini_ker_t2h.init b/tp/t/init/mini_ker_t2h.init
index 38f68c4ca6..f3c226eb3c 100644
--- a/tp/t/init/mini_ker_t2h.init
+++ b/tp/t/init/mini_ker_t2h.init
@@ -17,7 +17,7 @@ sub mini_ker_element_type($$$$)
my $overview = &{$self->formatting_function('format_contents')}($self,
'shortcontents');
if ($overview) {
- $result .= '<h2> ' .$self->convert_tree($self->gdt('Overview:'))
+ $result .= '<h2> ' .$self->convert_tree($self->cdt('Overview:'))
. "</h2>\n" . "<blockquote>\n";
$result .= $overview;;
$result .= "</blockquote>\n";
diff --git a/tp/t/init/translate_txiinternalvalue_macro.init
b/tp/t/init/translate_txiinternalvalue_macro.init
index 8269fd1a7f..723038f650 100644
--- a/tp/t/init/translate_txiinternalvalue_macro.init
+++ b/tp/t/init/translate_txiinternalvalue_macro.init
@@ -13,7 +13,7 @@ sub my_sp_formatting($$$$$)
and defined($command->{'extra'}->{'misc_args'})
and defined($command->{'extra'}->{'misc_args'}->[0])) {
my $sp_nr = $command->{'extra'}->{'misc_args'}->[0];
- my $translated_tree = $self->gdt('@macro txiinternalvalue
+ my $translated_tree = $self->cdt('@macro txiinternalvalue
user internalvalue
@end macro
{myarg} @TeX{}', {'myarg' => {'contents' => [{'text' => $sp_nr}]}});
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 95001a9c52..1a1aa34ab6 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1529,7 +1529,7 @@ while(@input_files) {
my $main_configuration = Texinfo::MainConfig::new();
# encoding is needed for output files
- # encoding and documentlanguage are needed for gdt() in
regenerate_master_menu
+ # documentlanguage is needed for gdt() in regenerate_master_menu
Texinfo::Common::set_output_encodings($main_configuration, $document);
if (not defined($main_configuration->get_conf('documentlanguage'))
and defined ($document_information->{'documentlanguage'})) {