So I have made a *.qm file with translation done via QLinguist. Now I'm trying to translate program by clicking the button, but nothing happens.
it's files hierarchy
QTranslator translator;
void ChatWindow::on_actionRussian_triggered()
{
translator.load(":/chApp_ru.qm");
qApp->installTranslator(&translator);
ui->retranslateUi(this);
}
The problem is that you must place the path of the generated file, in your case
Translations/chApp_ru.qmsince this is a conversion ofchApp_ru.ts, and the latter file takes as reference a relative path:I recommend adding to your qresource the .qm file that is in the translations folder.
Add it as shown in the figure:
And you have to modify your code to:
Output: