Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Question on translations and .ts files



  • 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?


  • Moderators

    @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



  • Thanks for confirming and explaining!


Log in to reply