Results 1 to 8 of 8

Thread: Localizing built-in GUI

  1. #1
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Localizing built-in GUI

    I can localize texts that I can edit in the source code or in the UI designer, but some texts are filled by Qt framework, example, the ButtonGroup class has some default buttons, ok|cancel, yes|no, save|cancel, etc. How can I localize these texts on the buttons.

    And more general questions, how can I tell Qt to localize its default texts to my language, as I can do with my tr() texts?

  2. #2
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Localizing built-in GUI

    hey !!

    qt ui isn't localized?
    how can i get the buttonGroup with arabic ??

    it's a basic question I think !!

  3. #3
    Join Date
    Apr 2010
    Posts
    16
    Thanks
    1
    Qt products
    Platforms
    Windows

    Default Re: Localizing built-in GUI

    from tests that i have done if have found that they are localized. if i changed my system language (on windows) i did get russian dialog boxes for example. dont know how to override these translations though.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Localizing built-in GUI

    Quote Originally Posted by ahmdsd_ostora View Post
    it's a basic question I think !!
    So why don't you give the answer yourself

    I never have need it, but I remember you have to deploy the translator files of Qt with your application. Have a look at Internationalization with Qt in the documentation.

  5. #5
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Localizing built-in GUI

    Quote Originally Posted by Lykurg View Post
    So why don't you give the answer yourself

    I never have need it, but I remember you have to deploy the translator files of Qt with your application. Have a look at Internationalization with Qt in the documentation.
    Yes. it's a basic question, because I have worked on many platforms and frameworks and this was so simple job. But in Qt I don't know how to do this here.

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Localizing built-in GUI

    Quote Originally Posted by ahmdsd_ostora View Post
    But in Qt I don't know how to do this here.
    Well, if you wont read the proposed sites in the documentation:
    1. copy the qt_XX.qm to your release folder
    2. Add in your main.cpp something like:
    Qt Code:
    1. QApplication a(argc, argv);
    2. QTranslator qtTranslator;
    3. qtTranslator.load("qt_" + QLocale::system().name(),
    4. QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    5. a.installTranslator(&qtTranslator);
    To copy to clipboard, switch view to plain text mode 
    and it will work.

  7. The following 3 users say thank you to Lykurg for this useful post:

    ahmdsd_ostora (11th August 2010), shagrouni (5th September 2010)

  8. #7
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Localizing built-in GUI

    Thank you it works.

    I want to add a tip considering this issue:
    Qt translator file should be loaded by another QTranslator object than the one you used to load your own translation file.

    So, you will need two QTranslator objects with the two .qm files. And these two translators should be installed on tou application object.

  9. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Localizing built-in GUI

    Quote Originally Posted by ahmdsd_ostora View Post
    I want to add a tip considering this issue:
    Qt translator file should be loaded by another QTranslator object than the one you used to load your own translation file.

    So, you will need two QTranslator objects with the two .qm files. And these two translators should be installed on tou application object.
    Yes of course, I just was shorten the code. Two translations is how they do it in the mentioned "Internationalization with Qt".

Similar Threads

  1. Replies: 3
    Last Post: 11th May 2010, 04:50
  2. qwt cannot be built
    By estradasphere in forum Qt-based Software
    Replies: 1
    Last Post: 20th March 2010, 18:43
  3. Built EXE
    By vinny gracindo in forum Newbie
    Replies: 4
    Last Post: 3rd February 2010, 17:39
  4. QT Dialog Localizing Images
    By nomad1980 in forum Qt Programming
    Replies: 1
    Last Post: 12th September 2008, 17:53
  5. Localizing date times in item views
    By jpn in forum Qt Programming
    Replies: 6
    Last Post: 6th February 2007, 14:47

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.