Results 1 to 6 of 6

Thread: Qt Designer and id based translation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Designer and id based translation

    Thanks, I dont need source, so discarded comments are fine. Second thing is that lupdate still takes strings from ui file and not from generated header.

    What I want to achieve is .ts file for all translatable strings like this:
    Qt Code:
    1. <context>
    2. <message id="tr_number__hint">
    3. <source></source>
    4. <translation type="unfinished"></translation>
    5. </message>
    6. <message id="tr_gsm__hint">
    7. <source></source>
    8. <translation>Translation</translation>
    9. </message>
    10. </context>
    To copy to clipboard, switch view to plain text mode 
    indtead of:
    Qt Code:
    1. <context>
    2. <name>core::InitialDialog</name>
    3. <message>
    4. <source>tr_number__hint</source>
    5. <translation type="unfinished"></translation>
    6. </message>
    7. <message>
    8. <source>tr_gsm__hint</source>
    9. <translation type="unfinished"></translation>
    10. </message>
    11. </context>
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Qt Designer and id based translation

    Hmm.

    How about this:

    - you move everything that you have in your .pro file other than FORMS to a .pri file
    - you include that .pri file in your .pro
    - you create a second .pro that includes the .pri and instead of FORMS adds the generated ui_*.h to SOURCES and uses that for lupdate's run

    Cheers,
    _

  3. #3
    Join Date
    Aug 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Designer and id based translation

    Thank you, it works, but I still have a problem. When using uic with -tr qtTrid, it generates function like
    Qt Code:
    1. qtTrId("tr_string", 0)
    To copy to clipboard, switch view to plain text mode 
    That second parameter is wrong. I've solved that by downloading uic source and modifying it. Problem is, that I dont know how to make qmake use my uic.exe instead of the original one, which I dont want to replace. I've tried QMAKE_UIC but it does nothing.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Qt Designer and id based translation

    Quote Originally Posted by Gery View Post
    Problem is, that I dont know how to make qmake use my uic.exe instead of the original one, which I dont want to replace. I've tried QMAKE_UIC but it does nothing.
    Interesting, I would have also expected that QMAKE_UIC would be the means to that.

    Maybe something like
    Qt Code:
    1. load(uic)
    2. uic.commands = .....
    To copy to clipboard, switch view to plain text mode 

    or creating a new uic command/target, like the new_moc example here http://qt-project.org/doc/qt-4.8/qma...ml#customizing

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 5th July 2012, 15:51
  2. Replies: 1
    Last Post: 10th February 2011, 21:32
  3. Translation for qt based libraries
    By elektritter in forum Installation and Deployment
    Replies: 3
    Last Post: 15th August 2009, 08:46
  4. Replies: 2
    Last Post: 27th June 2007, 11:23
  5. Replies: 1
    Last Post: 22nd January 2007, 13:13

Tags for this Thread

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.