On Sat, May 04, 2019 at 03:26:34PM +0200, Ludovic Courtès wrote:
> Hello!
>
> The Guix manual has this bit of text:
>
> --8<---------------cut here---------------start------------->8---
> This manual is also available in Simplified Chinese (@pxref{Top,,, guix.zh_CN,
> GNU Guix参考手册}), French (@pxref{Top,,, guix.fr, Manuel de référence de GNU
> Guix}), German (@pxref{Top,,, guix.de, Referenzhandbuch zu GNU Guix}), and
> Spanish (@pxref{Top,,, guix.es, Manual de referencia de GNU Guix}).
> --8<---------------cut here---------------end--------------->8---
>
> and ‘htmlxref.cnf’ contains these lines:
>
> --8<---------------cut here---------------start------------->8---
> guix.de mono ${GS}/guix/manual/de/guix.html
> guix.de node ${GS}/guix/manual/de/html_node/
> guix.es mono ${GS}/guix/manual/es/guix.html
> guix.es node ${GS}/guix/manual/es/html_node/
> guix.fr mono ${GS}/guix/manual/fr/guix.html
> guix.fr node ${GS}/guix/manual/fr/html_node/
> guix mono ${GS}/guix/manual/en/guix.html
> guix node ${GS}/guix/manual/en/html_node/
> --8<---------------cut here---------------end--------------->8---
>
> Yet, in the HTML output, references to “guix.fr” etc. are always
> replaced by the URL of the English manual (“guix”).
>
> Is the “.LANG” extension in the manual name somehow stripped?
Hello Ludo, the extension is stripped in the _external_node_href
function in HTML.pm. I found this one-line change would give the
desired output (when I added those lines to htmlxref.cnf):
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 9ac4ae7..e987382 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5820,7 +5820,7 @@ sub _external_node_href($$$$)
{ 'code' => 1,
Texinfo::Common::_convert_text_options($self)});
my $manual_base = $manual_name;
- $manual_base =~ s/\.[^\.]*$//;
+ $manual_base =~ s/\.info*$//;
$manual_base =~ s/^.*\///;
my $document_split = $self->get_conf('SPLIT');
$document_split = 'mono' if (!$document_split);
I don't know for sure what the justification is
for that, but I suspect it is because some Texinfo manuals in the past
have used a file extension inside the cross-reference commands, like
this: @xref{node,,, manual.info, Manual}.
> Is there a workaround you would recommend?
It would be more reliable to call the translated manuals guix-de,
guix-es etc. The full stop may be used to strip off a file extension in
other contexts; for example, the info browser might find it hard to
distinguish between an Info file guix.de.info and a file guix.info.
One issue is that Info files may be compressed and installed as e.g.
guix.info.gz, so the info browser has taken the simple approach of
stripping off all suffixes.