Results 1 to 3 of 3

Thread: Translating non-hardcoded string

  1. #1
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Translating non-hardcoded string

    Hi,
    I've started a small project which should (besides other things) be able to load a file containing strings like {L_TITLE} which should get translated.
    This way, lupdate and the translation system of Qt is not able to recognize those strings.
    Is it possible to use the .ts files with Qt Linguist here or do i have to write a translation class on my own?
    C167

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Translating non-hardcoded string

    .ts file basically maps one string to another. You can create a file with string constants you want to be able to translate (wrapped with QT_TR_NOOP macro) and add it to your sources, so that lupdate can pick them up and then just make sure that you use tr() in proper place.

    Another approach is to create your own .ts file with just those strings. This way you will get a separate .qm file, but that's shouldn't be a problem.

  3. #3
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Translating non-hardcoded string

    Oh, thx.
    at the moment, i try to find a sed line to extract those strings out of phpbb3 (their translation system is my basis atm). I hope that i can write some small test programs to get familiar with the translation system.

Similar Threads

  1. Reading from sockets in a multithreaded program
    By KoosKoets in forum Qt Programming
    Replies: 9
    Last Post: 4th April 2007, 20:43
  2. 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

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.