[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: pylupdate6: cannot parse python files without directly referencing module name
From: Albin Söderqvist <albin.soderqvist () hostmobility ! com>
Date: 2023-06-30 7:32:29
Message-ID: c71a682e1f125d3d0b8e849471bcf25da57fbdf4.camel () hostmobility ! com
[Download RAW message or body]
Hi,
I'm unable to extract strings for translation using pylupdate6 without
calling QCoreApplication.translate each time. With pylupdate5, I can
import translation (or import translation as som_other_name) which is
convenient.
$ cat bug.py
from PyQt6.QtCore import QCoreApplication
from QCoreApplication import translate
a = translate("Bugs", "Can parse this with pylupdate5 but not
pylupdate6 (<= 6.5.1)")
b = QCoreApplication.translate("Bugs", "Can parse this with both v5 and
v6")
$ pylupdate6 bug.py -ts translation_template.ts
Summary of changes to translation_template.ts:
1 new messages were added
$ cat translation_template.ts
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Bugs</name>
<message>
<location filename="bug.py" line="7" />
<source>Can parse this with both v5 and v6</source>
<translation type="unfinished" />
</message>
</context>
</TS>
$ rm translation_template.ts
$ pylupdate5 bug.py -ts translation_template.ts
$ cat translation_template.ts
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>Bugs</name>
<message>
<location filename="bug.py" line="7"/>
<source>Can parse this with both v5 and v6</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bug.py" line="6"/>
<source>Can parse this with pylupdate5 but not pylupdate6
(<= 6.5.1)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
I don't have this issue with .ui files.
---
Albin Söderqvist
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic