[Qt-interest] Translation doesn't work

Sebastian Schöbinger sebastianlaptop at inode.at
Fri Apr 17 12:14:14 CEST 2009


hi

I have 2 problems with the translation in my program.

First I defined in a global source file a StringList with languages and
language infos.

I defined it like this:

languages << tr("Arabic") + ";sa;ar"

                    << tr("Chinese") + ";cn;zh;"

                    << tr("Croatian") + ";hr;hr;";


after that I added them into a comboBox, but it was still english
(instead of german), but everything else was german.


QStringList languageList = globals::languageList();

for (int i = 0; i < languageList.size();++i) {

QStringList tempList = languageList[i].split(";");

m_ui->firstLanguageBox->addItem(QIcon(":/flags/" + tempList[1]),
QString("%1 (%2)").arg(tempList[0],tempList[2]));


My second problem is nearly the same, but that is in the toolbar.

QAction *action;

QMenu *menu;

::writerDockAction = new QAction( this);

::writerDockAction->setText( tr("Writer"));

::writerDockAction->setCheckable(true);

::writerDockAction->setIcon( QIcon("://writer"));

connect(::writerDockAction, SIGNAL(triggered(bool)), this,
SLOT(toggleWriterDock(bool)));

ui->mainToolBar->addAction(::writerDockAction);


here is the same problem, everything else is translated, but not the toolbar


Sebastian




More information about the Qt-interest-old mailing list