[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 8 Nov 2022 03:29:24 -0500 (EST) |
branch: master
commit 2ea54f3cf8fb65416249513b3377dee0290719c0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Oct 31 15:13:08 2022 +0100
* doc/texi2any_api.texi (Translated Strings Customization),
tp/init/documentation_examples.pm (my_format_translate_string):
add translation strings customization example in
documentation_examples.pm and fix in manual.
---
ChangeLog | 7 +++
doc/texi2any_api.texi | 6 +--
tp/init/documentation_examples.pm | 29 +++++++++++
tp/t/init_files_tests.t | 3 ++
.../init_files_tests/documentation_examples.pl | 60 +++++++++++++++++++++-
.../res_html/documentation_examples_fot.html | 8 +--
.../documentation_examples/res_html/index.html | 12 +++--
.../res_html/prepended_to_filenames-my-node.html | 8 +--
8 files changed, 116 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 08412501cb..21eaa32a99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-31 Patrice Dumas <pertusus@free.fr>
+
+ * doc/texi2any_api.texi (Translated Strings Customization),
+ tp/init/documentation_examples.pm (my_format_translate_string):
+ add translation strings customization example in
+ documentation_examples.pm and fix in manual.
+
2022-10-31 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Config.pm (texinfo_register_direction_string_info):
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 2e025489a0..429fa277e9 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -3067,7 +3067,7 @@ my %translations = (
'fr' => @{
'error-->' => @{'' => 'erreur-->',@},
# @dots{}
- @}
+ @},
'de' => @{
'error-->' => @{'' => 'Fehler-->',@},
# @dots{}
@@ -3078,7 +3078,7 @@ my %translations = (
sub my_format_translate_string($$$;$$$)
@{
my ($self, $string, $lang, $replaced_substrings,
- $translation_context, $type) = @_;
+ $translation_context, $type) = @@_;
$translation_context = '' if (!defined($translation_context));
if (exists($translations@{$lang@})
and exists($translations@{$lang@}->@{$string@})
@@ -3093,7 +3093,7 @@ sub my_format_translate_string($$$;$$$)
@}
texinfo_register_formatting_function('format_translate_string',
- \&_my_format_translate_string);
+ \&my_format_translate_string);
@end example
diff --git a/tp/init/documentation_examples.pm
b/tp/init/documentation_examples.pm
index 983f79b53a..2913f508b1 100644
--- a/tp/init/documentation_examples.pm
+++ b/tp/init/documentation_examples.pm
@@ -18,6 +18,18 @@ if (not defined($default_footnotestyle)) {
$main_program_footnotestyle = 'not separate '.$default_footnotestyle;
}
+my %translations = (
+'fr' => {
+'error-->' => {'' => 'erreur-->',},
+# ...
+},
+'de' => {
+'error-->' => {'' => 'Fehler-->',},
+# ...
+}
+# ...
+);
+
texinfo_register_no_arg_command_formatting('-', undef, '­');
texinfo_register_no_arg_command_formatting('error', undef, undef, undef,
@@ -129,4 +141,21 @@ sub my_label_target_name($$$) {
texinfo_register_file_id_setting_function('label_target_name',
\&my_label_target_name);
+sub my_format_translate_string($$$;$$$)
+{
+ my ($self, $string, $lang, $replaced_substrings,
+ $translation_context, $type) = @_;
+ $translation_context = '' if (!defined($translation_context));
+ if (exists($translations{$lang})
+ and exists($translations{$lang}->{$string})
+ and exists($translations{$lang}->{$string}->{$translation_context})) {
+ my $translation = $translations{$lang}->{$string}->{$translation_context};
+ return $self->replace_convert_substrings($translation,
+ $replaced_substrings, $type);
+ }
+ return undef;
+}
+
+texinfo_register_formatting_function('format_translate_string',
+ \&my_format_translate_string);
1;
diff --git a/tp/t/init_files_tests.t b/tp/t/init_files_tests.t
index 0749a5316e..61280eacc1 100644
--- a/tp/t/init_files_tests.t
+++ b/tp/t/init_files_tests.t
@@ -82,6 +82,9 @@ my @file_tests = (
@sansserif{in--example} @- c. @error{}
@end example
+@documentlanguage fr
+
+@error{}.
@node my node
diff --git a/tp/t/results/init_files_tests/documentation_examples.pl
b/tp/t/results/init_files_tests/documentation_examples.pl
index 899b004e39..029b771561 100644
--- a/tp/t/results/init_files_tests/documentation_examples.pl
+++ b/tp/t/results/init_files_tests/documentation_examples.pl
@@ -237,7 +237,7 @@ $result_trees{'documentation_examples'} = {
},
'source_info' => {
'file_name' => '',
- 'line_nr' => 18,
+ 'line_nr' => 21,
'macro' => ''
}
},
@@ -523,6 +523,59 @@ $result_trees{'documentation_examples'} = {
',
'type' => 'empty_line'
},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'documentlanguage',
+ 'extra' => {
+ 'spaces_before_argument' => ' ',
+ 'text_arg' => 'fr'
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 17,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'error',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 19,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => '.
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ },
{
'text' => '
',
@@ -577,6 +630,9 @@ $result_texis{'documentation_examples'} = '
@sansserif{in--example} @- c. @error{}
@end example
+@documentlanguage fr
+
+@error{}.
@node my node
@@ -596,6 +652,8 @@ in--math a=b error-->
in--example c. error-->
+error-->.
+
';
diff --git
a/tp/t/results/init_files_tests/documentation_examples/res_html/documentation_examples_fot.html
b/tp/t/results/init_files_tests/documentation_examples/res_html/documentation_examples_fot.html
index 988f9a2817..6c74fe1ab2 100644
---
a/tp/t/results/init_files_tests/documentation_examples/res_html/documentation_examples_fot.html
+++
b/tp/t/results/init_files_tests/documentation_examples/res_html/documentation_examples_fot.html
@@ -3,10 +3,10 @@
<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Footnotes (someone@example.com (me) undefined text-align:center, is
undef|end|separate in–title error-->)</title>
+<title>Notes de bas de page (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title erreur-->)</title>
-<meta name="description" content="Footnotes (someone@example.com (me)
undefined text-align:center, is undef|end|separate in–title error-->)">
-<meta name="keywords" content="Footnotes (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title error-->)">
+<meta name="description" content="Notes de bas de page (someone@example.com
(me) undefined text-align:center, is undef|end|separate in–title
erreur-->)">
+<meta name="keywords" content="Notes de bas de page (someone@example.com (me)
undefined text-align:center, is undef|end|separate in–title
erreur-->)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="viewport" content="width=device-width,initial-scale=1">
@@ -23,7 +23,7 @@
</p>
</div>
<hr>
-<h4 class="footnotes-heading">Footnotes</h4>
+<h4 class="footnotes-heading">Notes de bas de page</h4>
<h5 class="footnote-body-heading"><a id="FOOT1"
href="index.html#DOCF1">(1)</a></h5>
<p>in footnote <code>HTML</code> text </p>
diff --git
a/tp/t/results/init_files_tests/documentation_examples/res_html/index.html
b/tp/t/results/init_files_tests/documentation_examples/res_html/index.html
index e8d8685afd..3e0102a096 100644
--- a/tp/t/results/init_files_tests/documentation_examples/res_html/index.html
+++ b/tp/t/results/init_files_tests/documentation_examples/res_html/index.html
@@ -3,10 +3,10 @@
<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Top (someone@example.com (me) undefined text-align:center, is
undef|end|separate in–title error-->)</title>
+<title>Top (someone@example.com (me) undefined text-align:center, is
undef|end|separate in–title erreur-->)</title>
-<meta name="description" content="Top (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title error-->)">
-<meta name="keywords" content="Top (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title error-->)">
+<meta name="description" content="Top (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title erreur-->)">
+<meta name="keywords" content="Top (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title erreur-->)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="viewport" content="width=device-width,initial-scale=1">
@@ -28,7 +28,7 @@ h1.titlefont {text-align:center}
<a class="node-id" id="prepended_to_labels-Top"></a><div class="nav-panel">
<p>
-Next: <a href="prepended_to_filenames-my-node.html" accesskey="n"
rel="next">my node</a> </p>
+Suivant: <a href="prepended_to_filenames-my-node.html" accesskey="n"
rel="next">my node</a> </p>
</div>
<hr>
<h1 class="node">Top</h1>
@@ -45,10 +45,12 @@ See <a class="xref"
href="prepended_to_filenames-my-node.html">my node</a><a cla
</pre></div>
+<p>erreur-->.
+ <code>HTML</code> text </p>
<hr>
<div class="nav-panel">
<p>
-Next: <a href="prepended_to_filenames-my-node.html" accesskey="n"
rel="next">my node</a> </p>
+Suivant: <a href="prepended_to_filenames-my-node.html" accesskey="n"
rel="next">my node</a> </p>
</div>
diff --git
a/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-my-node.html
b/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-my-node.html
index 8adfd24617..375a4d1014 100644
---
a/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-my-node.html
+++
b/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-my-node.html
@@ -3,10 +3,10 @@
<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>my node (someone@example.com (me) undefined text-align:center, is
undef|end|separate in–title error-->)</title>
+<title>my node (someone@example.com (me) undefined text-align:center, is
undef|end|separate in–title erreur-->)</title>
-<meta name="description" content="my node (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title error-->)">
-<meta name="keywords" content="my node (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title error-->)">
+<meta name="description" content="my node (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title erreur-->)">
+<meta name="keywords" content="my node (someone@example.com (me) undefined
text-align:center, is undef|end|separate in–title erreur-->)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="viewport" content="width=device-width,initial-scale=1">
@@ -20,7 +20,7 @@
<body lang="en">
<a class="node-id" id="prepended_to_labels-my-node"></a><div class="nav-panel">
<p>
-Previous: <a href="index.html" accesskey="p" rel="prev">Top</a> </p>
+Précédent: <a href="index.html" accesskey="p" rel="prev">Top</a>
</p>
</div>
<hr>
<h4 class="node">my node</h4>
- master updated (183227df2e -> 2dff71c663), Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08