bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document translations broken in Texinfo 7.0.90?


From: Gavin Smith
Subject: Re: Document translations broken in Texinfo 7.0.90?
Date: Tue, 17 Oct 2023 13:59:18 +0100

On Tue, Sep 26, 2023 at 08:34:52PM +0100, Gavin Smith wrote:
> On Wed, Aug 30, 2023 at 06:19:53PM +0200, Patrice Dumas wrote:
> > > I wonder if there is anything that can be done with the gettext API to
> > > try for a translation both with and without a context.  What occurs to
> > > me is testing the return value of pgettext, seeing if it is equal to the
> > > input string, and if it is (so the translation failed), calling gettext
> > > instead (without the context).
> > 
> > That could be a transitory measure to wait for translations to be
> > updated.  We could do that in particular if we notice that many
> > translations are not updated for the official release.
> 
> This does not even work.  I tried it with the latest de.po in the
> "texinfo_document" domain.  The de.po file has a line:
> 
> #: tp/Texinfo/Convert/HTML.pm:738 tp/Texinfo/Convert/HTML.pm:742
> #: tp/Texinfo/Convert/HTML.pm:794
> msgid "Next"
> msgstr "Nächste"
> 
> which gives the translation of "Next" (without a context), but when
> I run "make update-po" this line goes away, and we have lines like
> the following instead:
> 
> #: tp/Texinfo/Convert/HTML.pm:2143
> #, fuzzy
> #| msgid "Next"
> msgctxt "NodeNext direction string"
> msgid "Next"
> msgstr "Nächste"
> 
> I only got this translation to be used by removing the "#, fuzzy" line.

I've made a commit to adjust the translations.  See commit 8144698cc8b6e.
This means that the translations will be maintained for several important
languages.  Even the German translation, which has not been updated since
2014, still had a measure of valued functionality, as evinced by Jonas'
complaint.

I was going to make the Texinfo 7.1 release today but will leave it a day
or two in case there is any feedback on this change.

(Aside: I wonder if the texinfo_document translation domain needs to
be advertised to translators more, as the "texinfo" domain is more
maintained (see https://translationproject.org/domain/texinfo.html), although
"texinfo_document" is arguably more important, it being used for the
end users of documentation rather than the writers.)

Alternative approach:  It is possible to use the old translation file.
The Makefile rule does

rm -f de.gmo && /usr/bin/msgmerge --for-msgfmt -o de.1po de.po 
texinfo_document.pot && /usr/bin/msgfmt -c --statistics --verbose -o de.gmo 
de.1po && rm -f de.1po

To keep the translation of "Next", without a context, then the msgmerge
invocation needs to be avoided:

/usr/bin/msgfmt -c --statistics --verbose -o de.gmo de.po

(This version of de.po contains "PO-Revision-Date: 2014-04-11 22:11+0100\n").

Then, with a change to texi2any to attempt to use the translation without
a context:

diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index b16940d39a..f56c9193b5 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -197,6 +197,9 @@ sub gdt($$;$$$$)
   if (defined($translation_context)) {
     $translated_string = Locale::Messages::pgettext($translation_context,
                                                      $string);
+    if ($translated_string eq $string) {
+      $translated_string = Locale::Messages::gettext($string);
+    }
   } else {
     $translated_string = Locale::Messages::gettext($string);
   }

I could get the following output in HTML for "@documentlanguage de":

<div class="nav-panel">
<p>
Nächste: <a href="#Chapter-Node" accesskey="n" rel="next">Chapter</a> &nbsp; 
</p>
</div>

Other nav panels also had the correct text "Nach oben", "Vorige".

However, downsides of this approach are:
* Other obsolete, unused strings will be included in the installed *.mo files
* It would require messing with the build system under po_document/ and
  whatever Makefile.in.in is, which seems hard to understand.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]