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. Question on translations and .ts files
Forum Updated to NodeBB v4.3 + New Features

Question on translations and .ts files

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 291 Views 2 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.
  • M Offline
    M Offline
    Marc_Van_Daele
    wrote on last edited by
    #1

    My current .ts file looks like

    <context>
        <name>A</name>
        <message>
            <location filename="A.qml" line="10"/>
            <source>History</source>
            <translation>Historique</translation>
        </message>
    

    I note that qsTr("History")

    • translates fine in A.qml, line 10
    • translates fine in A.qml, any other line
    • does not translate in B.qml (there is no entry yet in the .ts file for B)

    Is this expected behavior?

    J.HilkJ 1 Reply Last reply
    0
    • M Marc_Van_Daele

      My current .ts file looks like

      <context>
          <name>A</name>
          <message>
              <location filename="A.qml" line="10"/>
              <source>History</source>
              <translation>Historique</translation>
          </message>
      

      I note that qsTr("History")

      • translates fine in A.qml, line 10
      • translates fine in A.qml, any other line
      • does not translate in B.qml (there is no entry yet in the .ts file for B)

      Is this expected behavior?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @Marc_Van_Daele said in Question on translations and .ts files:

      Is this expected behavior?

      yes it is,

      each source file (c++ or qml) has it's own contextblock

      by running lupdate on your project, a context block will be created for b . Then there will be an automatic check for similar heuristics, and the translation in A will be detected and preselected for you.

      IIRC running lrelease now will result in A and B being correctly translated, even without confirming the preselected translation before via (Qt)Linguist


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Marc_Van_Daele
        wrote on last edited by
        #3

        Thanks for confirming and explaining!

        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