I’m using the static QMessageBox functions for a small download tool I wrote. Unfortunately, I struggled a little bit with the translation of the OK and Cancel buttons. There is some information available by asking uncle google, but the information revealed seems not 100% correct for Qt 5.3.
What you need to do is to load the Qt translation file in addition to your original .qm file(s) at the same time you load your own translation file(s). The file is located in the translation sub-folder of your Qt installation folder. For the OK and Cancel buttons you would need to load the “qtbase_XX” where XX should be replaced with your locale:
int main(int argc, char *argv)
QApplication a(argc, argv);
// Own translation file
translator.load(a.applicationName() + "_" + QLocale::system().name(), a.applicationDirPath());
// Translation file for Qt stuff
translator2.load("qtbase_" + QLocale::system().name(), a.applicationDirPath());
Original Qt FAQ:
Hope this is of some help. I appreciate all comments, just use the comment box below.
Latest posts by Mike Bergmann (see all)
- Check if your crross-compiler GCC toolchain is supporting hard-float - October 25, 2019
- Linux kernel consoleblank argument ignored - September 19, 2017
- 010 Editor – Fix not showing help file - June 10, 2016