Problem with QTranslator (by GNU gettext user)

Phil Thompson phil at riverbankcomputing.com
Sun Jun 18 09:34:21 BST 2023


On 17/06/2023 22:31, ekhumoro wrote:
> On 16/06/2023 21:20, Florian Bruhin wrote:
>> Hey,
>> 
>>> Here is my minimal (not so) working Python example.
>> 
>> For what it's worth, the buttons are translated to German correctly 
>> for
>> me with your example and LANG=de_DE.UTF-8
>> (Qt 5.15.10+kde+r129, PyQt 5.15.9, Archlinux)
> 
> The issue here is that the OP is using a local pip installation. This
> exposes a bug in the PyQt5 PyPI package, which
> includes some invalid translation files. The problem can be seen if
> you install PyQt5 into a venv and then run lconvert
> on the *local* qt_de.qm file, which produces this:
> 
> 
>   <?xml version="1.0" encoding="utf-8"?>
>   <!DOCTYPE TS>
>   <TS version="2.1" language="de">
>   <dependencies>
>   <dependency catalog="qtbase_de"/>
>   <dependency catalog="qtscript_de"/>
>   <dependency catalog="qtmultimedia_de"/>
>   <dependency catalog="qtxmlpatterns_de"/>
>   </dependencies>
>   </TS>
> 
> As you can see, this includes a dependency on the qtscript_de.qm file,
> which the PyQt5 PyPI package does not provide.
> Unfortunately, QTranslator will refuse to load a qm file with missing
> dependencies, so the other files will be ignored,
> and no translation will occur (i.e. load will return False).
> 
> PyQt5 has never provided the QtScript module, so the translation files
> should never include any dependencies on it
> either. However, keeping the dependency and including all the
> qtscript_*.qm files would work just as well.
> 
> Phil: is there any chance this problem could be fixed?

It will be fixed in the next PyQt-builder snapshot, but I don't have any 
immediate plans to update the PyQt5-Qt5 wheels.

Phil


More information about the PyQt mailing list