[PySide] Translation problem

Jaakko Juvonen jaakko.k.juvonen at gmail.com
Wed Oct 3 09:10:03 CEST 2012


Hi,

This is propably the official "forum" of PySide? (new on the mailing list :))

I’ve just migrated from PyQt to PySide and I’m now working with
translations. With PyQt the translations worked perfectly, but now
with PySide there are some texts that are not translated. I’m very
confused, as I think I’m handling all the texts the same way.

What I’ve done so far:

1. Changed the string formatting from PyQt format “Hello %1” to PySide
format “Hello {0}”
2. Deleted old .ts translation files (lupdate had some problems,
better to start from scratch)
3. Generated new .ts files with command
        C:\Python27\Lib\site-packages\PySide\pyside-lupdate.exe
Ui_MainWindow.py MainWindow.py -ts translations\German.ts
4. Translated all texts using Qt Linguist and marked text status to “ready”
5. Compiled .qm files with command
        C:\Python27\Lib\site-packages\PySide\lrelease.exe translations\German.ts

After this most of the translations are working, e.g.:

self.userLabel.setText(self.tr('User: {0}').format(self.user.name))

…but in the same file some of the texts are not translated. These
texts are often (but not always) related to QMessageboxes, e.g.:

reply = QMessageBox.question(self, self.tr('Quit program'),
           self.tr('Exiting program. Do you want to save the changes
to report data?'),
           QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)

When I look into .ts files, I see that both these texts are translated
to German and their translation status is the same. I’d be very happy
for any clues where to continue investigating the problem.

My configuration:
Windows 7 (64 bit)
Python 2.7.3 (32 bit)
PySide 1.1.2 (32 bit)

Thanks a lot!



More information about the PySide mailing list