PDA

View Full Version : namespaces and translations



gri
30th March 2007, 09:31
Hello,

I've created a dialog with the designer and put the derived class into a namespace. "lupdate" does not recognize this :( Does anyone know a solution for that?


namespace myProgram
{
class myClass : public QDialog, protected UI::myDialog
{
public:
myClass(QWidget* parent=0);

void myTestFunction()
{
QMessageBox::information(this, "", tr("Hello World"));
}
};
}

"lupdate" generates the translation context for "myClass" but the tr("Hello World") will translate in "myProgram::myClass" :(

patrik08
30th March 2007, 09:38
Hello,

I've created a dialog with the designer and put the derived class into a namespace. "lupdate" does not recognize this :( Does anyone know a solution for that?


namespace myProgram
{
class myClass : public QDialog, protected UI::myDialog
{
public:
myClass(QWidget* parent=0);

void myTestFunction()
{
QMessageBox::information(this, "", tr("Hello World"));
}
};
}

"lupdate" generates the translation context for "myClass" but the tr("Hello World") will translate in "myProgram::myClass" :(


Have you test the namespace Ui = namenspace from designer?
I suppose other namenspace not help lupdate..


protected UI::myDialog ????

gri
30th March 2007, 09:47
Have you test the namespace Ui = namenspace from designer?
I suppose other namenspace not help lupdate..


protected UI::myDialog ????
This was just code written for the post ...
The real namespace created from uic is "Ui", right.

The problem is the namespace-containing translation context, not the code :)

gri
30th March 2007, 09:53
Ok, solved it myself.

When using namespaces with Qt you have to do the namespace{} also in the .cpp. Simply using "using namespace myProgram;" and implementing does also work but "lupdate" puts the translated text into the wrong context (without namespace).