Qt World Summit: Register Today!

Multiple language with database in runtime in Qt

  • Hi Guys!
    My question may not be organically related to QT (of course, partly it does because I want to solve it with QT)
    How would you start an application where you can change the language on run time? So, an application that does not require restarting.
    (I would like it in the form of a dictionary, I do not want QT to translate the texts).
    I saw solutions to this in an example with language files, but I could not make it to translate the value in the variable to what I specified in the file.
    Besides, there is also the database, from which I expose some data as text on the screen. How would it be worth doing the database for this? How can I use the database in QT to convert its text at run time?
    Thank you in advance for your ideas and answers!

  • Lifetime Qt Champion


    Qt's translation system uses QTranslator for it's magic. If you want to do something 100% custom then you need to mimic that and use for example a custom event for which you will trigger update to all the texts on your widget like shown in the Dynamic Translation chapter.

  • @SGaist Ty! I solved the problem :)

  • Lifetime Qt Champion

    You're welcome !

    Can you share what you did ? :-)

Log in to reply