How to translate the OK and Cancel buttons of the static QMessageBox functions

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:

Original Qt FAQ:


Hope this is of some help. I appreciate all comments, just use the comment box below.

The following two tabs change content below.

Mike Bergmann

Technical software developer loving low level, bit peeking, embedded development as well as GUI, OO, and X-platform development.


  1. Helped me getting started. Thanks for that. Do you have any idea, where to get an english version of qtbase_.qm file? I am german, my button texts are german by default (Ja/Nein instead of Yes/No). My problem is, I cannot find qtbase_en.qm file on my system. Taking a russian or hungarian for testing works (after renaming it to qtbase_en.qm). Am I missing something here or why is there no qtbase_en.qm???

  2. Hi René, great that my small post is of some help. I neither have qt_base_en in my Qt directory. I assume there is no English translation file because all the text within Qt are in English by default and they rather change the source instead of fixing typos via translation table. I work on a German system, too (Switzerland) and I have English buttons by default:

    Have you build a release version of your program and tried it on a clean system (without Qt installed).? What language are your Yes/No buttons on a clean system?

  3. Thanks for your reply! I have tested it on a clean system. Without any qtbase_xx.qm file the default dialog elements are in english there. So it must be the Qt installation on my “working machine”, that defaults these GUI elements to german language. When I use the qtbase_de.qm and NO such file for english language, it works now.

    Anyway it would be nice, if there was a ts or qm file for english language, just to not have different behaviour of the application on different machines, depending on the presence of a QT installation on that machine. On my machine, where QT is installed, I cannot switch to english language completely… With an english ts file this would be possible. Of course I could modify a german ts file to be an english one and then translate all the entries, but actually I don’t have time for that.

    Thank you for your help!


Have your say