Results 1 to 5 of 5

Thread: setText translation

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default setText translation

    1.I create a QTreeWidgetItem
    Qt Code:
    1. QTreeWidgetItem *cities = new QTreeWidgetItem(this);
    2. cities->setText(0, tr("Cities"));
    To copy to clipboard, switch view to plain text mode 
    and use lupdate and linguist to translate "Cities" into other languages.but it can not ,and "Cities" still exist.Why?
    By the way,I create a Menu,
    Qt Code:
    1. fileMenu = menuBar()->addMenu(tr("&File"));
    To copy to clipboard, switch view to plain text mode 
    and the program can do translation.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setText translation

    What steps did you take? Did you actually install a translator?
    J-P Nurmi

  3. #3
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: setText translation

    What I have done as follows:
    1. add TRANSLATIONS = hellotr_la.ts to the xxx.pro
    2.lupdate –verbose xxxx.pro
    3.Linguist hellotr_la.ts translate what need to,and release the file
    4.compile and run my program.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setText translation

    Yes, but in your program. Do you install a translator as explained in the Internationalization with Qt document?
    J-P Nurmi

  5. #5
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: setText translation

    I think I have done,the following is my code in main function
    Qt Code:
    1. main()
    2. {
    3. ...
    4. QTranslator appTranslator;
    5. appTranslator.load("coin3dtr_la");
    6. QApplication::installTranslator(&appTranslator);
    7. ...
    8. }
    To copy to clipboard, switch view to plain text mode 
    By the way,I create a Menu,
    Qt Code:
    1. fileMenu = menuBar()->addMenu(tr("&File"));
    To copy to clipboard, switch view to plain text mode 
    and the program can does translation.

Similar Threads

  1. QPushButton setText problem
    By batileon in forum Qt Programming
    Replies: 3
    Last Post: 3rd December 2008, 03:02
  2. How avoid translation of dynamic properties
    By thomas_-_s in forum Qt Tools
    Replies: 1
    Last Post: 19th October 2008, 22:02
  3. More CPU Load when using SetText
    By arunvv in forum Newbie
    Replies: 3
    Last Post: 23rd January 2008, 19:35
  4. Problem with QLabel and setText
    By jambrek in forum Qt Programming
    Replies: 7
    Last Post: 31st October 2007, 16:02
  5. Splitting Translation Files
    By Jimmy2775 in forum Qt Programming
    Replies: 9
    Last Post: 3rd February 2006, 19:23

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
  •  
Qt is a trademark of The Qt Company.