Here is how I did it:
First you need to copy the file qt_LOCALE.qmto your application directory. My was:
cp /usr/share/qt4/translations/qt_fr.qm .
Secondly, you need to download a translator for your application.
application = QApplication(argv)
locale = QLocale.system().name()
qtTranslator = QTranslator()
if qtTranslator.load("qt_"+locale):
application.installTranslator(qtTranslator)
main_window = QMainWindow()
main_window.show()
exit(application.exec_())
source
share