[PyQt] Internationalization problem

Thorsten Kampe thorsten at thorstenkampe.de
Fri Oct 19 21:47:58 BST 2007


[latest PyQt]

Hi,

reading through Mark Summerfield's book I've tried to localise my 
appliation. This works fine for my own translation but not for the one 
from Trolltech (qt_de.qm). This means that for instance all my menus 
are in German but the close, maximize, minimize and restore buttons in 
the upper right edge are still in English.

This is an excerpt from my script:

##
import my_application_rc
[...]
qtTranslator  = QtCore.QTranslator()
qtTranslator.load(':/qt.qm')
app.installTranslator(qtTranslator)

appTranslator = QtCore.QTranslator()
appTranslator.load(':/my_application.qm')
app.installTranslator(appTranslator)
##

And this is the part from the resource file:
##
<qresource lang="de">
    <file alias="my_application.qm">translation/my_application_de.qm
</file>
    <file alias="qt.qm">translation/qt_de.qm</file>
</qresource>
##

Mark writes:
"We don't have to worry about translating the buttons in this case 
because we are using standard buttons and Qt has translations for 
these.[*] If we had used our own texts we would have had to use tr() 
on them, like any other user-visible string.

[*]Trolltech provides translations for some languages, such as French 
and German, [...]. These translations are in Qt's (not PyQt's) 
translations directory; search your file system for qt_fr.qm for 
example, to find the French translation."

Does anyone have a hint why it's not working though?


Thorsten



More information about the PyQt mailing list