pylupdate5 forgets translations of lines containing Unicode

Anton Yablokov stsav012 at gmail.com
Wed Apr 14 07:37:36 BST 2021


I've conducted some research. It appears that for non-ASCII lines, <message>
XML tag of TS files should have encoding="UTF-8" attribute. For some
reason, PyQt5 Linguist 5.12.8 I have omits the attribute. Without it, the
translation gets lost.

I can't really dig much deeper into the problem. Is it fixed in newer
Linguist versions?
🍏


On Mon, Apr 12, 2021 at 8:26 PM Anton Yablokov <stsav012 at gmail.com> wrote:

> Dear community,
>
> I've just bumped into a troubling behavior of pylupdate5. Namely, it
> marks the translations of lines containing Unicode symbols besides ASCII as
> unfinished and actually removes the translation.
>
> Here is an MWE:
>
> from PyQt5.QtCore import QCoreApplication
>
> _translate = QCoreApplication.translate
> _translate('microvolts', 'uV')
> _translate('microvolts', 'μV')
>
>
> On it, run
>
>  pylupdate5 -noobsolete *.py -ts microvolts.ts
>
> once, then complete (and save) the translation using linguist, then run
> pylupdate5 again with the same parameters. The translation of
>
> 'μV'
>
> vanishes:
>
> <         <translation>μV</translation>
> ---
> >         <translation type="unfinished"></translation>
>
> Checked with PyQt5 5.13.2 through 5.15.4 on Linux.
>
> Best regards,
> Anton Yablokov
> 🍏
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210414/0d8c796b/attachment.htm>


More information about the PyQt mailing list