Answer the question
In order to leave comments, you need to log in
How to translate a program into Python?
Good day everyone!
Wrote a small text editor and ran into this problem. Buttons in pop-up windows in English (QMessageBox.Yes, for example). I found on the Internet how to translate all the keys in the program, but there is no result.
I'm using PyQt5. If anyone knows the solution, write in detail how to write it correctly or what exactly I wrote wrong.
if __name__=='__main__':
app = QApplication(sys.argv)
locale = QLocale.system().name()
QTranslator = QTranslator()
if QTranslator.load('C:/Python34/Lib/site-packages/PyQt5/translations/qt_' + locale):
app.installTranslator(QTranslator)
window = Edit()
window.show()
sys.exit(app.exec_())
Answer the question
In order to leave comments, you need to log in
If the standard buttons are not flexible enough for your message box, you can use the addButton() overload that takes a text and a ButtonRole to add custom buttons. The ButtonRole is used by QMessageBox to determine the ordering of the buttons on screen (which varies according to the platform).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question