PDA

View Full Version : Getting and setting default language from source



Coder5546
5th June 2014, 12:20
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

yeye_olive
5th June 2014, 14:01
I suppose you install translators using QCoreApplication::installTranslator(). Removing all of them with QCoreApplication::removeTranslator() should disable translation.

Coder5546
6th June 2014, 11:52
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 ?

wysota
6th June 2014, 12:16
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().