Has anyone gottent the tr method to translate?

You can use the qm file from the QT 2.3.1 i8ln example to test this.  The QApplication 
method below will correctly
translate.  The tr method of the MyWidget object will not.

Is this fixed in CVS as I am using 2.5pre2 to test this?

import sys
from qt import *

class MyWidget(QMainWindow):
                def __init__(self):
                                QMainWindow.__init__(self,None,'',Qt.WDestructiveClose)
                                                self.setCaption( self.tr( 
"Internationalization Example" ) );

if __name__ == '__main__':
                a = QApplication(sys.argv)
                QObject.connect(a,SIGNAL('lastWindowClosed()'),a,SLOT('quit()'))
                translator = QTranslator(None)
                translator.load( "mywidget_fr.qm", "." )
                a.installTranslator( translator )

                print(translator.contains("MyWidget", "Internationalization Example"))
                print(QTextCodec.locale())
                w = MyWidget()
#               w.setCaption(QTextCodec.locale())
                w.setCaption(a.translate("MyWidget", "Internationalization Example"))
#               w.setCaption(w.tr("First"))
                a.setMainWidget(w)
                w.show()
                a.exec_loop()

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde

Reply via email to