Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How smart is the Qt Translation system?

How smart is the Qt Translation system?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 419 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by fcarney
    #1

    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?

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

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

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved