Qt Linguist can't find some words
-
Hi guys,
I'm having a problem using Qt linguist. I don't know why the name of the QToolButton I create in the .cpp are not found when i generate the .ts file. This is the code I'm talking about:
addCanali = new QToolButton(ui->toolBar); addCanali->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); addCanali->setIcon(QIcon(":/rec/img/wave_amplify_frequency.png")); addCanali->setStyleSheet("background-color:black; color:white"); addCanali->setText("Channels"); //this is the word I have to translate addCanali->setFocusPolicy(Qt::NoFocus); ui->toolBar->addWidget(addCanali); connect(addCanali, SIGNAL(clicked()), this, SLOT(on_actionCanale_triggered()));
To create the .ts file I followed this tutorial. Basically the steps are:
1- Open MinGw command line
2 - Go to your project folder
3- lupdate -pro yourappname.pro -ts Italian.tsTo add some more information, the File .cpp where these words are is under a .pri file, I don't know if maybe this can cause some issues while creating the .ts file.
Am I missing something?
Thanks in advance.
-
Hi guys,
I'm having a problem using Qt linguist. I don't know why the name of the QToolButton I create in the .cpp are not found when i generate the .ts file. This is the code I'm talking about:
addCanali = new QToolButton(ui->toolBar); addCanali->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); addCanali->setIcon(QIcon(":/rec/img/wave_amplify_frequency.png")); addCanali->setStyleSheet("background-color:black; color:white"); addCanali->setText("Channels"); //this is the word I have to translate addCanali->setFocusPolicy(Qt::NoFocus); ui->toolBar->addWidget(addCanali); connect(addCanali, SIGNAL(clicked()), this, SLOT(on_actionCanale_triggered()));
To create the .ts file I followed this tutorial. Basically the steps are:
1- Open MinGw command line
2 - Go to your project folder
3- lupdate -pro yourappname.pro -ts Italian.tsTo add some more information, the File .cpp where these words are is under a .pri file, I don't know if maybe this can cause some issues while creating the .ts file.
Am I missing something?
Thanks in advance.
@davidesalvetti said in Qt Linguist can't find some words:
addCanali->setText("Channels");
shouldn't it be
addCanali->setText(tr("Channels"));
?
-
@davidesalvetti said in Qt Linguist can't find some words:
addCanali->setText("Channels");
shouldn't it be
addCanali->setText(tr("Channels"));
?
@jsulm yes, my mistake. I'm sorry. I just read this from Docs. Thanks a lot!