[PyQt] pylupdate5 issues with non standard syntax

Hans-Peter Jansen hpj at urpla.net
Thu Dec 1 15:54:34 GMT 2016


Hi Phil,

in an attempt to create a PyQt distutils extension, that covers the usual tool 
chain, I noticed, that pylupdate behaves strangely, when using the "non 
standard syntax" in such a way, that file references loose their path. That 
results in .ts files, that linguist cannot display properly the sources, resp. 
forms for.

Given a project layout:

project/
	i18n/
	ui/

it should be possible to run:

pylupdate5 project/ui/*.ui project/*.py -ts project/i18n/*.ts

.ts file with non standard layout:

    <message>
        <location filename="some.py" line="123"/>
        <source>Message</source>
        <translation>Translation</translation>
    </message>
    <message>
        <location filename="some.ui" line="123"/>
        <source>Message</source>
        <translation>Translation</translation>
    </message>

while is expected:

    <message>
        <location filename="../some.py" line="123"/>
        <source>Message</source>
        <translation>Translation</translation>
    </message>
    <message>
        <location filename="../ui/some.ui" line="123"/>
        <source>Message</source>
        <translation>Translation</translation>
    </message>

In other words, the references must be given relative to the translation file.

The attached patch attempts to fix this behaviour, hopefully. At least, it 
works for me... A similar PyQt4 fix might be in order.

Cheers,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pylupdate_fix.diff
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161201/5cdbadb7/attachment.bin>


More information about the PyQt mailing list