How smart is the Qt Translation system?



  • Okay, we have 2 programs that share the same source files. One acts like a server and sends log messages to the other program. We don't want to translate the server app for various reasons. However, when we receive messages from the server app we want to translate those messages in the client app. This is all fine and dandy as I can put QT_TRANSLATE_NOOP with a specific context in the server source files. Then in the client I can translate those according to that context.

    However, there is a big issue with this. What happens to text like this?

    QT_TRANSLATE_NOOP("Log Message", "Status: %1")
    

    By the time the message gets to the client it will look like this:

    "Status: Something"
    

    So, does the qsTranslate("Log Message", message) do any kind of regex to match the string or is it a straight string comparison?


  • Qt Champions 2018

    You will have to either translate it to the correct language on the server or send the string to translate and the arguments separately and combine them on the client so 'Status: %1' can be correctly translated.



  • I was afraid that would be the answer. Thank you!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.