PDA

View Full Version : Can I translate data with GUI element.



mourad
2nd June 2008, 09:28
Hi everybody, I want to add into my application a Translation menu which change the current langage to the selected one. For the GUI element and user messages, there's no problem, I will use QtLinguist. But I wann to change whith thme the data. There's any methode to translate the data when I change the langage. Can anyone tell me how to do this konwing that I dispose in my database of all the data in the different langages.
Best regards.

wysota
2nd June 2008, 09:41
QObject::tr() is the way to go. Wrap every user visible string in it and then run lupdate as usual and do the translation. Then make sure you handle the QEvent::LanguageChange event for each of the classes and retranslate all strings there (Designer generated classes use the retranslateUi() method for this).