[PyQt] QCoreApplication.translate()

paolo at paolodestefani.it paolo at paolodestefani.it
Fri Jul 5 12:46:43 BST 2013


Hi
I'm trying to internationalize my PyQt application. Following the pyqt 
reference guide i'm trying to use QCoreApplication.translate() instead 
of self.tr().
Works but only if i write the full function. But if i want to shorten 
it in this way:

tr = QCoreApplication.translate

and then using

tr(contest, string, disambiguation)

it doesn't work ! I mean when i run pylupdate4.exe the created .ts file 
is empty.
If i change back using

QCoreApplication.translate(contest, string, disambiguation)

this works. The created .ts file is ok.

Why ? How can i use a short version of that function ? Is there another 
way i can use that function ?

I look for an answer to this question using google but i found only 
people with the same problem but no solution.
Looks like an pylupdate4 issue.


More information about the PyQt mailing list