diff options
-rw-r--r-- | tests/auto/linguist/lrelease/testdata/idbased.ts | 6 | ||||
-rw-r--r-- | tools/linguist/shared/translatormessage.cpp | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts index cd47158..c7555c8 100644 --- a/tests/auto/linguist/lrelease/testdata/idbased.ts +++ b/tests/auto/linguist/lrelease/testdata/idbased.ts @@ -18,5 +18,11 @@ <message> <source>Drop me!</source> </message> + <message id="one_id"> + <source></source> + </message> + <message id="two_id"> + <source></source> + </message> </context> </TS> diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp index 417f6b1..db6f333 100644 --- a/tools/linguist/shared/translatormessage.cpp +++ b/tools/linguist/shared/translatormessage.cpp @@ -151,6 +151,7 @@ bool TranslatorMessage::operator==(const TranslatorMessage& m) const return (m_context == m.m_context) && m_sourcetext == m.m_sourcetext && m_extra[msgIdPlural] == m.m_extra[msgIdPlural] + && m_id == m.m_id && (m_sourcetext.isEmpty() || m_comment == m.m_comment); } @@ -161,7 +162,9 @@ bool TranslatorMessage::operator<(const TranslatorMessage& m) const return m_context < m.m_context; if (m_sourcetext != m.m_sourcetext) return m_sourcetext < m.m_sourcetext; - return m_comment < m.m_comment; + if (m_comment != m.m_comment) + return m_comment < m.m_comment; + return m_id < m.m_id; } int qHash(const TranslatorMessage &msg) @@ -170,7 +173,8 @@ int qHash(const TranslatorMessage &msg) qHash(msg.context()) ^ qHash(msg.sourceText()) ^ qHash(msg.extra(QLatin1String("po-msgid_plural"))) ^ - qHash(msg.comment()); + qHash(msg.comment()) ^ + qHash(msg.id()); } bool TranslatorMessage::hasExtra(const QString &key) const |