On Thu, Oct 19, 2023 at 04:59:13PM +0200, Patrice Dumas wrote: > I think that it tests a case that is relative to the next change in > Changelog: > 2023-08-06 Patrice Dumas <pertu...@free.fr> > > * tp/Texinfo/Translations.pm (gdt): have the gettext framework convert > translated strings to UTF-8, and decode from UTF-8 to internal perl > encoding. > > If we use only UTF-8 encoded files, we do not get to see the effect of > that bug. That being said, if translation files are all UTF-8, the > bug and regressions if the test is removed would be harmless.
I see, I hadn't realised that. As you say, it's a theoretical problem as the other translation files are all either ASCII or UTF-8. The important thing is that the current code is correct and that it is clear how it works. It seems much clearer now than the previous version (with both the $encoding and $perl_encoding variables), so is likely to keep on working correctly. > > * Add Makefile rules to generate the file. The commit message says the > > file was produced "using iconv and manual edition" so it is not clear > > if it is easy to generate the file automatically from pl.po. If I do > > "diff pl.po pl.iso-8859-2.po" then most of the changes are either > > recoding of translations or updates to the header fields but there are > > a small number of other changes too. > > My feeling that this option should be easily done, I think I did an > iconv call, and the manual change could easily be a sed one liner, as I > believe that the only change is to replace > > "Content-Type: text/plain; charset=UTF-8\n" > by > "Content-Type: text/plain; charset=ISO-8859-2\n" > > I can try to do some Makefile rules to setup the file. > > We could add a line at the beginning, too, like > > # File automatically generated from pl.po for a text. This file > # should not be modified nor be used as a basis for setting up > # translations, the pl.po file should be used for that. > > > But this is not perfect, as you analysed, as we would still install a > useless file and we would still have a file that looks like the other po > files that are used for translations but is not. It may not do any harm to install the ISO-8859-2 file and have it available to use for translations. It just creates a question for anybody looking at the list of files of what this file is and where it has come from. > One option would be to make that test manual, have a script to setup the > pl.iso-8859-2.po file, run the test and remove the file. A bit like > tex-html tests tests, but with cleanup in addition. The rules under po_document/Makefile.in.in build the *.gmo files and the script would have to replicate that: $ touch pl.iso-8859-2.po $ make pl.iso-8859-2.gmo rm -f pl.iso-8859-2.gmo && /usr/bin/msgmerge --for-msgfmt -o pl.iso-8859-2.1po pl.iso-8859-2.po texinfo_document.pot && /usr/bin/msgfmt -c --statistics --verbose -o pl.iso-8859-2.gmo pl.iso-8859-2.1po && rm -f pl.iso-8859-2.1po pl.iso-8859-2.1po: 204 translated messages. Then the rules in tp/Makefile.docstr copy the *.gmo files to where they are used by texi2any. If that can be replicated, then it might be possible. Otherwise removing the test would be the simplest.