Annihilator
23rd September 2010, 20:59
Hi to all!
I generate ui_mainwindow.h from form where is all interface. Also I create context menu for tray icon after setupUI():
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
ui(new Ui::MainWindow), m_signalsIsBlocked(false)
{
ui->setupUi(this);
//........................
//..........................
CreateActions();
//......................
}
void MainWindow::CreateActions()
{
minimizeAction = new QAction(QObject::tr("Mi&nimize"), this);
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(on_actionMinimize_triggered()));
maximizeAction = new QAction(tr("Ma&ximize"), this);
connect(maximizeAction, SIGNAL(triggered()), this, SLOT(on_actionMaximize_triggered()));
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(on_actionRestore_triggered()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
}
Then I make *.ts by using lupdate, after that translate strings and make *.qm by using lrelease.
Then I add code to main():
QApplication a(argc, argv);
QTranslator appTrans;
QString langFile(":/i18n/vdynclient_ru_RU.qm"); // Russian translation
appTrans.load(langFile);
a.installTranslator(&appTrans);
But I get translated strings only for tray context menu, but not for all interface.
I tried to check translation by:
QString transl = appTrans.translate("MainContext", "Your E-mail:");
And got correct translation, cause one exists, but why isn`t it displayed on the form (every time I see only english words)?
Can anybody help, please?
I generate ui_mainwindow.h from form where is all interface. Also I create context menu for tray icon after setupUI():
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
ui(new Ui::MainWindow), m_signalsIsBlocked(false)
{
ui->setupUi(this);
//........................
//..........................
CreateActions();
//......................
}
void MainWindow::CreateActions()
{
minimizeAction = new QAction(QObject::tr("Mi&nimize"), this);
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(on_actionMinimize_triggered()));
maximizeAction = new QAction(tr("Ma&ximize"), this);
connect(maximizeAction, SIGNAL(triggered()), this, SLOT(on_actionMaximize_triggered()));
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(on_actionRestore_triggered()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
}
Then I make *.ts by using lupdate, after that translate strings and make *.qm by using lrelease.
Then I add code to main():
QApplication a(argc, argv);
QTranslator appTrans;
QString langFile(":/i18n/vdynclient_ru_RU.qm"); // Russian translation
appTrans.load(langFile);
a.installTranslator(&appTrans);
But I get translated strings only for tray context menu, but not for all interface.
I tried to check translation by:
QString transl = appTrans.translate("MainContext", "Your E-mail:");
And got correct translation, cause one exists, but why isn`t it displayed on the form (every time I see only english words)?
Can anybody help, please?