Discrepancy between pylupdate and Qt Linguist

Phil Thompson phil at riverbankcomputing.com
Sat Jul 12 10:43:36 BST 2025


On 12/07/2025 10:40, Detlev Offenbach wrote:
> Am 12.07.25 um 11:30 schrieb Phil Thompson:
>> On 12/07/2025 10:22, Detlev Offenbach wrote:
>>> Hi Phil,
>>> 
>>> I just tried the new pylupdate (actually just translation_file.py) 
>>> and
>>> must report, that the file generated by pylupdate and Qt linguist are
>>> still different. pylupdate indents all context elements by 4 spaces
>>> whereas Qt linguist does not indent them at all.
>>> 
>>> Would it be possible to align the bahavior of pylupdate with Qt 
>>> linguist?
>> 
>> So Qt Linguist is inconsistent in its indentation?
> Indeed it is. I tested it all the way back to Qt 6.2.x.
>> 
>> It would require indenting the file "manually". At the moment it 
>> uses...
>> 
>> https://docs.python.org/3.13/library/xml.etree.elementtree.html#xml.etree.ElementTree.indent
> Maybe indenting just the context_el with this method as if it were a
> root element and then write the top level stuff manually with zero
> indentation. Unfortunately I am not familiar with ElementTree to
> change this myself.

I'm not going to put effort into trying to match what is effectively a 
bug in Linguist.

Phil


More information about the PyQt mailing list