Results 1 to 4 of 4

Thread: Getting and setting default language from source

  1. #1
    Join Date
    Nov 2012
    Location
    Poland/UK
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Getting and setting default language from source

    Hi, I'm writing a program where the default language is English, additional languages ​​are loaded from qm files, eg Polish.
    How can I back to native language (English) without loading file ? (en.qm)
    English is default language in source code.

    Regards

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Getting and setting default language from source

    I suppose you install translators using QCoreApplication::installTranslator(). Removing all of them with QCoreApplication::removeTranslator() should disable translation.

  3. #3
    Join Date
    Nov 2012
    Location
    Poland/UK
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Getting and setting default language from source

    Quote Originally Posted by yeye_olive View Post
    I suppose you install translators using QCoreApplication::installTranslator(). Removing all of them with QCoreApplication::removeTranslator() should disable translation.
    Thank you for your reply. QCoreApplication::removeTranslator() does not restore the old translation.
    Any ideas ?

  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: Getting and setting default language from source

    You should have a translation catalog also for English (it can contain untranslated strings, you don't have to rewrite all the messages as translations) and then you can install that catalog on the translator. Also remember that you have to trigger retranslation after adding or removing translators by setting all user-visible strings again passing them through tr().
    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.


Similar Threads

  1. Setting default item in a QCombobox
    By graffy in forum Qt Programming
    Replies: 4
    Last Post: 14th August 2013, 12:13
  2. Replies: 2
    Last Post: 2nd March 2012, 07:07
  3. Replies: 3
    Last Post: 23rd April 2011, 16:42
  4. Setting a widget's QPalette to default?
    By Spectralist in forum Newbie
    Replies: 2
    Last Post: 29th December 2009, 21:47
  5. By default TreeWidget width setting in DockWidget
    By santosh.kumar in forum Qt Programming
    Replies: 0
    Last Post: 31st May 2007, 05:55

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.