On Thu, Oct 12, 2023 at 09:21:45AM +0300, Eli Zaretskii wrote: > > From: Gavin Smith <gavinsmith0...@gmail.com> > > Date: Wed, 11 Oct 2023 18:15:04 +0100 > > Cc: Patrice Dumas <pertu...@free.fr> > > > > On Wed, Oct 11, 2023 at 06:12:51PM +0100, Gavin Smith wrote: > > > I will send you a diff to try to see if it lets the tests pass, or if > > > we need to make any further changes. > > > > Attached. > > Thanks. This solves some of the diffs, but not all of them. In > addition, one test that previously passed now fails > (formatting_documentlanguage_cmdline.sh). I attach below the > redirected output of all the failed tests, which shows the diffs > against the expected results.
At least some of the test result differences appear to be due to updated translations (e.g. "Method" changing to "Méthode" in the French translation). It seems like document translations don't work at all if there is a context. In a simple test file "test-fr.texi": \input texinfo @documentlanguage fr @defmethod Window close (argument) close the window @end defmethod @bye the output from "texi2any.pl test-fr.texi" is: -- Method de Window : close (argument) close the window rather than, as expected -- Méthode de Window : close (argument) close the window po_document/fr.po correctly has #: tp/Texinfo/Common.pm:654 msgctxt "category of methods in object-oriented programming for @defmethod" msgid "Method" msgstr "M@'ethode" However, I don't see that this context is ever used to retrieve the translation. In Texinfo/Common.pm, in "our %def_map", the string is marked with pgdt: 'defmethod', {'defop' => pgdt( 'category of methods in object-oriented programming for @defmethod', 'Method')}, However, pgdt is not actually called as this marking is just for the benefit of extracting translatable strings from the program (pgdt is given a different definition locally). (It would be wrong anyway to translate the string here, as the document language is not known at this stage.) The parser module creates an "untranslated" text object. Here's part of the output from "TEXINFO_OUTPUT_FORMAT=debugtree ../tp/texi2any.pl test-fr.texi": def_line %block_line_arg a/\n/ bracketed_inserted untranslated |Method| spaces_inserted | | |Window| spaces | | |close| spaces | | delimiter |(| |argument| delimiter |)| In Texinfo/Convert/Plaintext.pm, around line 1835 an attempt is made to convert this "untranslated" object: } else { my $tree = $self->gdt($element->{'text'}); my $converted = _convert($self, $tree); return $converted; } - but this cannot work, as no context is provided for the translation. The 'category of methods in object-oriented programming for @defmethod' string does not occur anywhere else in the program other than in Texinfo/Common.pm. Why the translation actually works on MinGW is a mystery -- perhaps its version of gettext handles contexts slightly differently. Unless I have missed something, this means that the translation of these document strings does not work at all. Please let me know if I have missed something or misunderstood, but if not this whole aspect of the code needs to be re-done.