How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?
Here is how I did :
First you need to copy the qt_LOCALE.qm
file to your application directory. Mine was :
cp /usr/share/qt4/translations/qt_fr.qm .
Secondly, you need to load 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_())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With