Results 1 to 3 of 3

Thread: Qt Multi language app at runtime

  1. #1
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4

    Default Qt Multi language app at runtime

    I'm developing an app which supports switching language at runtime. I've read a lot of tutorial and qt Internationalization ... and I know the way to do is remove current translator and install new translator, then call method retranslateUi() to refresh view.
    If i use drag and drop feature, then qt generate method retranslateUi() and I don't need to implement it. But, if my form is manually implementation or implement a model of a table, so I must implement method retranslateUi() which is reset all text. This takes a lot of effort.
    Does someone know another way to make qt component automatically change text when even languageChange emitted without implement retranslateUi() method for each form ?

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Multi language app at runtime

    Hey, That is the only way for the language translations. Call retranslateUi() function. It is must. If you want to do it by another method then, delete the object of this widget and create it again when you're selecting the language. Note: Before deleting first install your translation file and then delete it.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

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

    vhptt (24th July 2012)

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

    Default Re: Qt Multi language app at runtime

    Quote Originally Posted by vhptt View Post
    Does someone know another way to make qt component automatically change text when even languageChange emitted without implement retranslateUi() method for each form ?
    Sure, you can hire someone to write it for you

    And seriously, all user-visible texts need to go through tr() again, there is no other way. If you want your code to be translatable, you have to move setting user-visible values to a separate method and then call that method from both the constructor and from LanguageChange event (it doesn't have to be called retranslateUi).
    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. The following user says thank you to wysota for this useful post:

    vhptt (24th July 2012)

Similar Threads

  1. Qt Assistant for custom help and multi-language
    By bec in forum Qt Programming
    Replies: 0
    Last Post: 14th April 2011, 08:54
  2. multi language support example
    By Ratheendrans in forum Qt Programming
    Replies: 6
    Last Post: 3rd April 2011, 02:50
  3. Common Language Runtime Support (/clr).
    By leoalvesmachado in forum Newbie
    Replies: 2
    Last Post: 8th July 2010, 14:09
  4. Multi language translation
    By bhaskar in forum Installation and Deployment
    Replies: 1
    Last Post: 14th June 2010, 16:30
  5. how change language at runtime?
    By mattia in forum Newbie
    Replies: 3
    Last Post: 14th November 2007, 18:36

Tags for this Thread

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.