[PyQt] Internationalisation process help

kib2 kib2 at free.fr
Thu Oct 18 19:42:44 BST 2007


Hi,

I'm trying to understand the internationalisation process in a PyQt4 app.
 From my main ui file (in French), I've got a ts one with pylupdate4, 
then translated it to binaries in qm format.
The resulting file is named 'em.qm' and is in my main app directory.

Now, my app looks like this :

 >Cut<------------------------------

from PyQt4 import QtGui, QtCore
from ui_editor import Ui_MainWindow

class MyApp(QtGui.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)

        # translation
        translator = QtCore.QTranslator()
        translator.load('en.qm')
        QtGui.qApp.installTranslator(translator)

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = MyApp()
    window.show()
    sys.exit(app.exec_())

 >Cut<------------------------------

But it does not seems to translate anything. I must miss something, but 
what ?

Thanks for your help :

Christophe K.




More information about the PyQt mailing list