PDA

View Full Version : String Externalization



bharat
7th October 2009, 10:54
Hi,

I would like to externalize my UI strings. The reason for this is that I am expecting users of my software to want to use their own strings in certain places. Example, mention their Company name in all Window titles etc.

I did find some articles and help on how to do Internationalization etc. but that is not all that I want.

I was wondering if QT has some sort of support internally, to do this or if I need to write my own code to support externalization of UI strings. Perhaps something can be done using qrc files ?

Thank you

Regards,
Bharat Varma

axeljaeger
7th October 2009, 13:11
See http://qt.nokia.com/doc/4.5/resources.html "Some resources, such as translation files and icons, many need to change based on the user's locale. This is done by adding a lang attribute to the qresource tag, specifying a suitable locale string. "

You can load additional resources at runtime, so you could exchange that resource files in your custom installation.

bharat
16th October 2009, 17:23
Hi,

I have tried this option and while technically it does work, I do have some issues with it.

I have a lot of text with styling, which I have done within the UI files of the corresponding widgets.

What I am doing to set text to a label / widget etc. is to simply read dictionaries from a file and then do a ->setText("");

setText seems to cause layout related issues *or* modify the style itself sometimes (in case of URLs)

Perhaps I am not going about this the right way. Any suggestions ?

wysota
17th October 2009, 10:24
Translations is not only about languages. You can load and install any translator on your application therefore you can modify the translation files in any way you see fit and then install them in your application using QTranslator.