Note that there are some explanatory texts on larger screens.

plurals
  1. POIdentifying messages in a Qt Linguist translation file (TS file)
    primarykey
    data
    text
    <p>I hope this is the right forum to ask this question. If it is not, please redirect me to a more suitable forum.</p> <p>I am trying to understand the format of a Qt Linguist TS file. I have modified a file and when I try to open it I get the error message "Duplicate messages found in ...". The file contains indeed one context with two messages that have</p> <ul> <li>the same source</li> <li>a location with the same file name but different line numbers</li> <li>different translation</li> </ul> <p>Here is the source code of a minimal file that gives this error:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!DOCTYPE TS&gt; &lt;TS version="2.0" language="es"&gt; &lt;context&gt; &lt;name&gt;MyContext&lt;/name&gt; &lt;message&gt; &lt;location filename="../../../../../MyFile.cpp" line="605"/&gt; &lt;source&gt;Delete&lt;/source&gt; &lt;translatorcomment&gt;Menu option&lt;/translatorcomment&gt; &lt;translation type="unfinished"&gt;&amp;amp;Borrar&lt;/translation&gt; &lt;/message&gt; &lt;message&gt; &lt;location filename="../../../../../MyFile.cpp" line="1572"/&gt; &lt;source&gt;Delete&lt;/source&gt; &lt;translation&gt;Eliminar&lt;/translation&gt; &lt;/message&gt; &lt;/context&gt; &lt;/TS&gt; </code></pre> <p>To my knowledge, each message is identified by context, source and location so this should not be a problem because the line numbers are different. Notice also that you cannot combine the two message elements into one, because they contain different translation texts.</p> <p>So it is not clear to me what can cause the error message. I am using Qt version 4.6.2. I have looked in the following documents: <a href="http://developer.qt.nokia.com/doc/qt-4.8/linguist-translators.html" rel="nofollow">Qt Linguist Manual: Translator</a>, <a href="http://developer.qt.nokia.com/doc/qt-4.8/linguist-programmers.html" rel="nofollow">Qt Linguist Manual: Programmers</a>, <a href="http://developer.qt.nokia.com/doc/qt-4.8/linguist-ts-file-format.html" rel="nofollow">Linguist TS file format</a>, but in none of them I have found the information I am looking for, namely how each message is identified and what could cause the error message in Qt Linguist.</p> <p>If you do not know the answer to this question, a link to further, more detailed information on the TS format would also be helpful.</p> <p><strong>UPDATE</strong></p> <p>I have found out that by using the optional tag TS/context/message/comment it is possible to have different translation texts for the same context/message/source, e.g.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!DOCTYPE TS&gt; &lt;TS version="2.0" language="es"&gt; &lt;context&gt; &lt;name&gt;MyContext&lt;/name&gt; &lt;message&gt; &lt;location filename="../../../../../MyFile.cpp" line="605"/&gt; &lt;source&gt;Delete&lt;/source&gt; &lt;comment&gt;Comment 1&lt;/comment&gt; &lt;translatorcomment&gt;Menu option&lt;/translatorcomment&gt; &lt;translation type="unfinished"&gt;&amp;amp;Borrar&lt;/translation&gt; &lt;/message&gt; &lt;message&gt; &lt;location filename="../../../../../MyFile.cpp" line="1572"/&gt; &lt;source&gt;Delete&lt;/source&gt; &lt;comment&gt;Comment 2&lt;/comment&gt; &lt;translation&gt;Eliminar&lt;/translation&gt; &lt;/message&gt; &lt;/context&gt; &lt;/TS&gt; </code></pre> <p>The above file can be opened without errors.</p> <p>This seems to solve my problem but it would be good to have some precise documentation about this format.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload