Results 1 to 4 of 4

Thread: Qt dialogs in other lenguages...

  1. #1
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    4

    Default Qt dialogs in other lenguages...

    Hi,

    I use QPrintDialog, QFileDialog, or QInputDialog in my Qt application, but when I use it I see it in english. Is it possible to translate to anothe language like spanish? I'm reading the Qt documentation but I'm not sure how to do it or if it is possible.

    Thanks a lot

  2. #2
    Join Date
    Apr 2006
    Location
    Saint-Petersburg, Russia
    Posts
    63
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt dialogs in other lenguages...

    Hello !

    You have to write all titles, texts etc. using tr() function and put file with translations in your project.
    Best regards,
    Yuriy Rusinov.

  3. The following user says thank you to YuriyRusinov for this useful post:

    Sparhawk (13th June 2008)

  4. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt dialogs in other lenguages...

    Read about QTranslator.
    You must create new QTranslator and set it in QApplication object. This is example code from my application which is working with Polish language.
    Qt Code:
    1. QApplication app(argc, argv);
    2. QTranslator qTtranslator;
    3. qTtranslator.load("qt_pl",":/Resources");
    4. app.installTranslator(&qTtranslator);
    To copy to clipboard, switch view to plain text mode 
    In QT dir look for qt_??.qm files.

  5. The following user says thank you to Lesiok for this useful post:

    Sparhawk (13th June 2008)

  6. #4
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt dialogs in other lenguages...

    Put this code to the constuctor of the main window:
    Qt Code:
    1. QTranslator *qtTranslator = new QTranslator;
    2. qtTranslator->load(QString("qt_%1").arg(QLocale::system().name()),
    3. QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    4. qApp->installTranslator(qtTranslator);
    To copy to clipboard, switch view to plain text mode 

    And read the documentation about the "Internationalization" item.
    Last edited by roxton; 13th June 2008 at 14:54.

Similar Threads

  1. Round-corner dialogs?
    By WinchellChung in forum Newbie
    Replies: 2
    Last Post: 14th March 2008, 19:47
  2. How to prevent recreation of dialogs
    By yektaayduk in forum Qt Programming
    Replies: 10
    Last Post: 11th November 2007, 15:01
  3. Skinned dialogs
    By Lele in forum Qt Programming
    Replies: 24
    Last Post: 9th August 2007, 08:43
  4. how to program custom Dialogs with return values
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2006, 00:37
  5. How to chain dialogs
    By seneca in forum Qt Programming
    Replies: 12
    Last Post: 14th January 2006, 22:04

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.