O'Reilly logo

Qt 5 Blueprints by Symeon Huang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing languages dynamically

Sometimes, people want to use languages other than the one specified by the system locale. This is a matter of application of the customized settings. This usually means restarting the application in order to load the corresponding translation file. This is partly because changing the language dynamically requires additional work. However, it's feasible and can be done with some lines. What's more important is that it delivers a better user experience!

Let's add a new push button to MainWindow. Name it loadButton and change its text to Load/Unload Translation. Then, edit the main.cpp file in the Edit mode. Remove all QTranslator related lines, as we'll be implementing this dynamic language switch in the MainWindow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required