[PyKDE] Localizing PyQt4 application

Ismail Donmez ismail at pardus.org.tr
Mon Dec 4 17:56:47 GMT 2006


04 Ara 2006 Pts 19:26 tarihinde, Andreas Pakulat şunları yazmıştı: 
> On 04.12.06 18:58:54, Ismail Donmez wrote:
> > Hi,
> >
> > I have the following code in my app:
> >
> > class MyApp(QtGui.QApplication):
> >     def __init__(self):
> >         QtGui.QApplication.__init__(self,sys.argv)
> >
> >         self.mainWindow = MainWindow()
> >
> >         self.translator = QTranslator()
> >         self.translator.load(("myapp-%s.qm" %
> > QLocale.system().name()), "/usr/share/myapp")
> >         self.installTranslator(self.translator)
> >
> >         self.mainWindow.show()
> >         self.exec_()
> >
> > if __name__ == "__main__":
> >     MyApp
> >
> > And
> > /usr/share/myapp/myapp-tr_TR.qm file exists. But when I start my app with
> > tr_TR locale it still shows English strings. I extracted the strings with
> > lupdate4 mainwindow.py -ts myapp.ts . So I wonder if I am doing something
> > wrong or maybe I have to re-implement a function?
>
> Works fine for me, did you translate all the strings using qt4's linguist?

It seems only QActions' are not translated, they are like :

self.printAct = self.toolbar.addAction(QIcon(":/images/print.png"), 
self.tr("&Print..."))

Not sure whats wrong, yet.

Regards,
ismail
-- 
A pisi up everyday keeps the bugs away




More information about the PyQt mailing list