Results 1 to 4 of 4

Thread: String Externalization

  1. #1
    Join Date
    Sep 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default String Externalization

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: String Externalization

    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.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Sep 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: String Externalization

    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 ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: String Externalization

    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.
    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. Using ANSI string type
    By kahahn in forum Newbie
    Replies: 1
    Last Post: 20th June 2009, 23:52
  2. Replies: 0
    Last Post: 18th February 2009, 13:31
  3. String operations, printing to stdout
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 20th January 2009, 15:30
  4. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 14:40
  5. Create pixmap image from string
    By Morea in forum Qt Programming
    Replies: 5
    Last Post: 17th November 2006, 16:38

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
  •  
Qt is a trademark of The Qt Company.