2 years ago
#385849
Robert
Change language of standard contextMenu in PyQt5
I try to change the language of the standard contextMenu of QLineEdit, and all other TextEdit components in PyQt5. The language is in english but my locale language is german.
So Cut, Copy, Paste,Undo, Redo and the other things should be in german.
i tried with:
translator = QTranslator()
translator.load('qt_' + QLocale.system().name(),QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(translator)
but that does'nt work. What i have to do.
This is my code:
app = QApplication(sys.argv)
translator = QTranslator(app)
translator.load('qt_' + QLocale.system().name(), QLibraryInfo.location(QLibraryInfo.TranslationsPath)))
app.installTranslator(translator)
#print(translator.load('qt_' + QLocale.system().name(), QLibraryInfo.location(QLibraryInfo.TranslationsPath)))
#print(app.installTranslator(translator))
window = mainwindow()
window.show()
sys.exit(app.exec())
I dont know why but both prints give me False
But why?
If i do print(translator.language()) it return me de, so i dont understand why the translation is not working.
any idea?
python
pyqt5
translation
0 Answers
Your Answer