[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: pylupdate6: cannot parse python files without directly referencing module name
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2023-07-05 17:00:39
Message-ID: 4f93070e43f4034786064655201a9de0 () riverbankcomputing ! com
[Download RAW message or body]

On 30/06/2023 08:32, Albin Söderqvist wrote:
> 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

I assume you mean...

translate = QCoreApplication.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
> (&lt;= 6.5.1)</source>
>         <translation type="unfinished"></translation>
>     </message>
> </context>
> </TS>
> 
> I don't have this issue with .ui files.

Fixed in the next snapshot.

Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic