Results 1 to 3 of 3

Thread: QT translate with ID

  1. #1

    Default QT translate with ID

    Hello,

    I need to translate a program via QT translate.
    And I am looking a way to use ID instead of source message. But to keep source message as default value if ID was not find in translator.

    Something like:
    tr("ID_145587","This is default string")
    If ID_145587 is find by translator we use the translated string else we use "This is default string".

    I find a way to do this partialy
    //% "This is default string"
    QString translated = qtTrId("ID_GUI_1564");
    That allow to use "This is default string" if string as not been translate but display "ID_GUI_1564" if no qm loaded.
    And i do not find a way to work with string with param like tr("Value string is %1").arg(QString(value))

    There is any way to do that i need ?
    Last edited by nmantelier; 6th January 2017 at 13:10.

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

    Default Re: QT translate with ID

    Not sure I understand, qtTrId() returns a QString, "arg" is a method of that class.

    Cheers,
    _

  3. #3

    Default Re: QT translate with ID

    You have right i probably make a mistake on first try cause i was an error on qm Loading.

    I try the same with only this string on ts (I was using a ts with mix ID and classic tr) and that works.

Similar Threads

  1. Need people to translate my app
    By xtal256 in forum General Discussion
    Replies: 2
    Last Post: 29th April 2013, 23:28
  2. Translate my app (dynamic)
    By liran ritkop in forum Qt Programming
    Replies: 6
    Last Post: 31st March 2011, 10:25
  3. Dynamic Translate
    By liran ritkop in forum Qt Programming
    Replies: 14
    Last Post: 30th March 2011, 12:22
  4. Translate help framework's gui
    By yagabey in forum Qt Programming
    Replies: 0
    Last Post: 14th October 2010, 07:38
  5. translate on fly
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2009, 14:21

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.