Results 1 to 4 of 4

Thread: namespaces and translations

  1. #1
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default namespaces and translations

    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?

    Qt Code:
    1. namespace myProgram
    2. {
    3. class myClass : public QDialog, protected UI::myDialog
    4. {
    5. public:
    6. myClass(QWidget* parent=0);
    7.  
    8. void myTestFunction()
    9. {
    10. QMessageBox::information(this, "", tr("Hello World"));
    11. }
    12. };
    13. }
    To copy to clipboard, switch view to plain text mode 

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

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: namespaces and translations

    Quote Originally Posted by gri View Post
    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?

    Qt Code:
    1. namespace myProgram
    2. {
    3. class myClass : public QDialog, protected UI::myDialog
    4. {
    5. public:
    6. myClass(QWidget* parent=0);
    7.  
    8. void myTestFunction()
    9. {
    10. QMessageBox::information(this, "", tr("Hello World"));
    11. }
    12. };
    13. }
    To copy to clipboard, switch view to plain text mode 

    "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 ????

  3. #3
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: namespaces and translations

    Quote Originally Posted by patrik08 View Post
    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

  4. #4
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: namespaces and translations

    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).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.