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 to get the translations from ID based qm files?

How to get the translations from ID based qm files?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 560 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Rajashekara V
    wrote on last edited by
    #1

    Hi,
    I can get the translation of tr() based, from the qm files by loading in to QTranslator and using QTranslator::translate(args) function.
    But how can i get the translations of ID based qm files.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Via qsTrId or the other functions.
      https://doc.qt.io/qt-5/linguist-id-based-i18n.html

      1 Reply Last reply
      1
      • R Offline
        R Offline
        Rajashekara V
        wrote on last edited by
        #3

        yes,
        I used qsTrId in the cpp or qt and generated ts files and qm files.
        I need to read like QTranslator:translate(args).
        Is there anthing like this to read the translations from qm files?

        mrjjM 1 Reply Last reply
        0
        • R Rajashekara V

          yes,
          I used qsTrId in the cpp or qt and generated ts files and qm files.
          I need to read like QTranslator:translate(args).
          Is there anthing like this to read the translations from qm files?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Im not sure what you mean 100%
          translate(const char *context, const char *sourceText, const char *disambiguation = nullptr, int n = -1) const

          since ID based do not have a context, so not sure what you are looking for besides qsTrId() to translate something.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rajashekara V
            wrote on last edited by
            #5

            I need to verify and confirm that the translations exist in qm files.
            WIthout ID based ("tr()"), i'm able to verify by using translate function,
            but i don't know how to verify when i used ID based transaltions ("qsTrId()").

            mrjjM 1 Reply Last reply
            0
            • R Rajashekara V

              I need to verify and confirm that the translations exist in qm files.
              WIthout ID based ("tr()"), i'm able to verify by using translate function,
              but i don't know how to verify when i used ID based transaltions ("qsTrId()").

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Rajashekara-V

              Hi
              Im not sure either as we look up by id.
              so we have no source text to compare to.

              But you can have it add say "! " in front of non translated text so you can mark it thaat way, if that is helpful
              to your case.

              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