Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Search for a translation in qm/ts file?
Qt 6.11 is out! See what's new in the release blog

Search for a translation in qm/ts file?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
6 Posts 3 Posters 1.6k Views 3 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.
  • V Offline
    V Offline
    vdevadass
    wrote on last edited by vdevadass
    #1

    Hi,
    Is there a way to get a particular translation for a specific source and comment from a qm file.
    Consider this example:
    i already have a qm file loaded, say english qm, i want to show an arabic translation for one button.

    Is there an API or any way to do this?

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

      Hi
      Well you can load multiple translators
      http://doc.qt.io/qt-5/qcoreapplication.html

      and docs says "Translations are searched for in the reverse order in which they were installed"

      So yes, you might be able to get i to work if you control the replacement of text your self.

      Also it has direct translate
      http://doc.qt.io/qt-5/qtranslator.html#translate

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vdevadass
        wrote on last edited by
        #3

        @mrjj loading both files does not help since the translation exists for that button in both files, i want to show the arabic translation, if the application is in english and vice versa.

        Regarding QTranslator::translate(), does this work if i only load the file?

        If there is a function which took the qm file as input along with source and comment and returned the requested string?

        mrjjM 1 Reply Last reply
        0
        • V vdevadass

          @mrjj loading both files does not help since the translation exists for that button in both files, i want to show the arabic translation, if the application is in english and vice versa.

          Regarding QTranslator::translate(), does this work if i only load the file?

          If there is a function which took the qm file as input along with source and comment and returned the requested string?

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

          @vdevadass

          • QTranslator::translate(), does this work if i only load the file?

          i have not tested that. I think so yes.

          1 Reply Last reply
          0
          • Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • V Offline
              V Offline
              vdevadass
              wrote on last edited by
              #6

              Load the qm file and translate worked, thank you :)

              1 Reply Last reply
              1

              • Login

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