[PyKDE] Localizing PyQt4 application

Ismail Donmez ismail at pardus.org.tr
Mon Dec 4 17:47:55 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?

One thing is generated ts file have apparently lies about filenames and 
lines :
        <location filename="" line="136474548"/>

All location entries are the same.

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




More information about the PyQt mailing list