From: Oswald Buddenhagen Date: Thu, 1 Aug 2013 15:48:58 +0000 (+0200) Subject: don't ignore changes to meta data when updating translation units X-Git-Tag: accepted/tizen/20131212.181521~89^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=836f4ac4d465feec9510e3e0cf5c5e8483785178;p=platform%2Fupstream%2Fqttools.git don't ignore changes to meta data when updating translation units Task-number: QTBUG-18890 Change-Id: Iceb466105d5fae56da0e2d26cb245fa610fed865 Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- diff --git a/src/linguist/lupdate/merge.cpp b/src/linguist/lupdate/merge.cpp index bf77013..103e2b2 100644 --- a/src/linguist/lupdate/merge.cpp +++ b/src/linguist/lupdate/merge.cpp @@ -351,6 +351,7 @@ Translator merge( if (mvi >= 0) m.setComment(virginTor.constMessage(mvi).comment()); } else { + TranslatorMessage::ExtraData extras; const TranslatorMessage *mv; int mvi = virginTor.find(m); if (mvi < 0) { @@ -377,6 +378,8 @@ Translator merge( } // It is just slightly modified, assume that it is the same string + extras = mv->extras(); + // Mark it as unfinished. (Since the source text // was changed it might require re-translating...) newType = TranslatorMessage::Unfinished; @@ -386,6 +389,7 @@ Translator merge( } } else { mv = &virginTor.message(mvi); + extras = mv->extras(); if (!mv->id().isEmpty() && (mv->context() != m.context() || mv->sourceText() != m.sourceText() @@ -399,10 +403,8 @@ Translator merge( m.setOldSourceText(m.sourceText()); m.setSourceText(mv->sourceText()); const QString &oldpluralsource = m.extra(QLatin1String("po-msgid_plural")); - if (!oldpluralsource.isEmpty()) { - m.setExtra(QLatin1String("po-old_msgid_plural"), oldpluralsource); - m.unsetExtra(QLatin1String("po-msgid_plural")); - } + if (!oldpluralsource.isEmpty()) + extras.insert(QLatin1String("po-old_msgid_plural"), oldpluralsource); } } else { switch (m.type()) { @@ -432,6 +434,7 @@ Translator merge( // why not use operator=()? Because it overwrites e.g. userData. m.setReferences(mv->allReferences()); m.setPlural(mv->isPlural()); + m.setExtras(extras); m.setExtraComment(mv->extraComment()); m.setId(mv->id()); } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp index 78ab97b..ae4ac75 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -65,7 +65,7 @@ void FindDialog::reset() tr("%n item(s)", "merge from a finished singular form to an unfinished plural form", 4); - + //~ meta matter //% "Hello" qtTrId("xx_hello"); diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before index 379cce4..6adc539 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before @@ -6,6 +6,7 @@ Hello Hallo + something really clever diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result index de43266..aa25d42 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result @@ -7,6 +7,7 @@ Hello Hallo + matter