diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-10-22 08:31:38 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-10-22 08:40:43 (GMT) |
commit | 40b0291252ac07ebac4ba34221728651c887c9b3 (patch) | |
tree | 94f6a15adfe2c6c3a07b27aa1fe50bbbae6e4e35 | |
parent | f3d76ae452d1c430bf294a0750318327a866332c (diff) | |
download | Qt-40b0291252ac07ebac4ba34221728651c887c9b3.zip Qt-40b0291252ac07ebac4ba34221728651c887c9b3.tar.gz Qt-40b0291252ac07ebac4ba34221728651c887c9b3.tar.bz2 |
consider message id when comparing messages
-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 |