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 ...

Get Qt 5 Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.