hassan deldar
hassan deldar

Reputation: 293

How to change language at runtime in Qt?

I'm writing a multi-language program with the Qt framework. I want to change the language at runtime. I wrote the code below in a slot but it does not work.

    QTranslator translator;
    translator.load("arrowpad_tr");
    qApp->installTranslator(&translator);

Upvotes: 2

Views: 2344

Answers (1)

Bart
Bart

Reputation: 20028

Installing a translator only means that the specific translator becomes available. This is signaled by a LanguageChange event for the QCoreApplication. What you will still have to call is retranslateUi(); which will take care of the actual translation for Qt Designer widgets. For custom widgets you will have to create something similar based on the event.

Upvotes: 3

Related Questions