[Qt-interest] Language change

Alessandro Portale alessandro.portale at trolltech.com
Mon Nov 2 16:47:29 CET 2009


Anatoly Burakov wrote:
> ...
> can't change it on the fly. The QT help says everything about handling 
> the LanguageChange event, but says nothing about how to make that event 
> actually happen.

If your dialogs reimplement QWidget::changeEvent() and handle QEvent::LanguageChange, that's already most of the work.
A call of QCoreApplication::installTranslator should then post that LanguageChange event, and your dialogs can handle that. You need to call installTranslator, yourself, e.g. if the user selects another language in a menu. Qt does not listen to OS language changes (yet), so if you were looking for that, you need to do that by hand.

> Also, just as a side question - can i make Linguist ignore some of the 
> strings in my ui files? Like, i have two labels and i don't need QT to 
> change whatever they contain (their contents change programmatically).

Qt designer (4.6) lets you chose if a specific label text (or texts of other widgets) are translatable or not. Just uncheck the 'translatable' sub-property of the label text in the property editor.

-- 
Alessandro Portale
Software Engineer
Nokia, Qt Development Frameworks



More information about the Qt-interest-old mailing list