summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lupdate/merge.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 22:40:23 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 22:58:01 +0100
commita66698f947e8ded2e020defa626b154aca1fde9f (patch)
treeb91a1233b0d600ee44bee356b18065b60a4ed8f5 /tools/linguist/lupdate/merge.cpp
parent44cc160733a70f5dc613faed2051005de7e48f04 (diff)
handle messages with ids (more) correctly
when comparing two messages which both have ids, compare only the ids. this affects finding/reporting duplicates and merging.
Diffstat (limited to 'tools/linguist/lupdate/merge.cpp')
-rw-r--r--tools/linguist/lupdate/merge.cpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp
index 13ba4ae4e1..a72143939a 100644
--- a/tools/linguist/lupdate/merge.cpp
+++ b/tools/linguist/lupdate/merge.cpp
@@ -375,6 +375,7 @@ Translator merge(const Translator &tor, const Translator &virginTor,
++similarTextHeuristicCount;
neww++;
+ outdateSource:
m.setOldSourceText(m.sourceText());
m.setSourceText(mv.sourceText());
const QString &oldpluralsource = m.extra(QLatin1String("po-msgid_plural"));
@@ -392,23 +393,35 @@ Translator merge(const Translator &tor, const Translator &virginTor,
}
} else {
mv = virginTor.message(mvi);
- switch (m.type()) {
- case TranslatorMessage::Finished:
- default:
- if (m.isPlural() == mv.isPlural()) {
- newType = TranslatorMessage::Finished;
- } else {
- newType = TranslatorMessage::Unfinished;
- }
+ if (!mv.id().isEmpty()
+ && (mv.context() != m.context()
+ || mv.sourceText() != m.sourceText()
+ || mv.comment() != m.comment())) {
known++;
- break;
- case TranslatorMessage::Unfinished:
newType = TranslatorMessage::Unfinished;
- known++;
- break;
- case TranslatorMessage::Obsolete:
- newType = TranslatorMessage::Unfinished;
- neww++;
+ m.setContext(mv.context());
+ m.setComment(mv.comment());
+ if (mv.sourceText() != m.sourceText())
+ goto outdateSource;
+ } else {
+ switch (m.type()) {
+ case TranslatorMessage::Finished:
+ default:
+ if (m.isPlural() == mv.isPlural()) {
+ newType = TranslatorMessage::Finished;
+ } else {
+ newType = TranslatorMessage::Unfinished;
+ }
+ known++;
+ break;
+ case TranslatorMessage::Unfinished:
+ newType = TranslatorMessage::Unfinished;
+ known++;
+ break;
+ case TranslatorMessage::Obsolete:
+ newType = TranslatorMessage::Unfinished;
+ neww++;
+ }
}
// Always get the filename and linenumber info from the
@@ -421,6 +434,7 @@ Translator merge(const Translator &tor, const Translator &virginTor,
m.setPlural(mv.isPlural());
m.setUtf8(mv.isUtf8());
m.setExtraComment(mv.extraComment());
+ m.setId(mv.id());
}
}