Results 1 to 9 of 9

Thread: translation

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

    Default translation

    I create a translation,and want to translate English into chinese.
    but I find that that only the manwindow does,the other class (such as opendialog) all do not?
    why?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: translation

    Did you install a translator for strings from Qt library apart the translator for your own application strings?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Default Re: translation

    thk u for your answer.
    I think I have done.
    Qt Code:
    1. QTranslator qtTranslator
    2. qtTranslator.laod("pseim_translation/qt_zh_CN.qm");
    3. a.installTranslator(&qtTranslator);
    To copy to clipboard, switch view to plain text mode 

    In the other class(such as class inherited from QDialog),I have created my own string,and add 'tr' for them,but it is not traslated.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: translation

    Where did you put the above code? Are you sure the translator doesn't go out of scope? Where did you put the other translator, can we see code for it as well?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Default Re: translation

    I put them in the main function.

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. QTranslator newTranslator;
    6. newTranslator.load( "pseism_translation/satellite3d_zh.qm");
    7. a.installTranslator( &newTranslator );
    8.  
    9. QTranslator qtTranslator;
    10. qtTranslator.load( "pseism_translation/qt_zh_CN.qm");
    11. a.installTranslator( &qtTranslator );
    12.  
    13. Ogre3dFrame *frame=new Ogre3dFrame(QString(argv[1]),QString(argv[2]));
    14. frame->show();
    15.  
    16. return a.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 
    Strings in the Ogre3dFrame have been translated,Must I load traslator in the other class?how to realize it,for there only is "QApplication a(argc, argv);" in the main function ,and not in the other class.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: translation

    So what is translated and what is not? Did you translate all the texts in Linguist?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Default Re: translation

    Strings in the Ogre3dFrame have been translated,in other class not.
    Yes,I translate them in the Linguist.

    linguist..PNG

    Strings in the class circled by ellipse have been translated in the Linguist,and Strings in the Ogre3dFrame have been translated in the Linguist.when I run my program,the former not translated,the latter done.

  8. #8
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: translation

    Do you have Q_OBJECT macro in classes where you get no translations?

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

    Default Re: translation

    Yes,I have.

Similar Threads

  1. Translation of UI
    By elizabeth.h1 in forum Qt Programming
    Replies: 1
    Last Post: 2nd November 2009, 11:01
  2. Translation for plugins
    By gustavosbarreto in forum Qt Programming
    Replies: 0
    Last Post: 14th August 2009, 13:25
  3. problem with Translation
    By #andi# in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 15:14
  4. Translation of app and Qt Dialogs
    By honza in forum Qt Programming
    Replies: 4
    Last Post: 11th May 2009, 17:53
  5. Translation
    By merlvingian in forum Qt Programming
    Replies: 1
    Last Post: 14th August 2007, 17:45

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.