[PyQt] pylupdate5 issues with non standard syntax

Phil Thompson phil at riverbankcomputing.com
Sun Dec 4 12:14:16 GMT 2016


On 1 Dec 2016, at 3:54 pm, Hans-Peter Jansen <hpj at urpla.net> wrote:
> 
> 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.

Applied (with a small change).

Thanks,
Phil


More information about the PyQt mailing list