when a message which is first seen with only an id later gains a source
text, this text would not have been indexed. so a subsequent new message
with the same source, but without an id this time around, would not be
seen as a dupe of the first message.
Change-Id: Ib35f820e2b02311ea9c9996383a2789095098d6f
Reviewed-by: hjk <hjk@theqtcompany.com>
} else {
TranslatorMessage &emsg = m_messages[index];
if (emsg.sourceText().isEmpty()) {
+ delIndex(index);
emsg.setSourceText(msg.sourceText());
+ addIndex(index, msg);
} else if (!msg.sourceText().isEmpty() && emsg.sourceText() != msg.sourceText()) {
cd.appendError(QString::fromLatin1("Contradicting source strings for message with id '%1'.")
.arg(emsg.id()));
// test TR_EXCLUDE
#include "notincluded.cpp"
+
+
+
+// failure to update index on insertion messes up subsequent de-duplication
+int dupeFail()
+{
+ // First just the Id.
+ qtTrId("dupe_id");
+
+ // Then with source
+ //% "This is the source"
+ qtTrId("dupe_id");
+
+ // Finally, same source, but without ID.
+ QCoreApplication::translate("", "This is the source");
+}
<extracomment>This is a message without a source string</extracomment>
<translation type="unfinished"></translation>
</message>
+ <message id="dupe_id">
+ <location filename="main.cpp" line="404"/>
+ <location filename="main.cpp" line="408"/>
+ <location filename="main.cpp" line="411"/>
+ <source>This is the source</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>Bogus</name>