diff options
author | David Boddie <dboddie@trolltech.com> | 2010-09-01 11:07:47 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-09-01 11:07:47 (GMT) |
commit | 63129c8bd21bfdc8110680296bb3bc1ab5e43343 (patch) | |
tree | 0b797ce849c191942713b618068aba0619788d57 /tools/linguist/shared/xliff.cpp | |
parent | d3b898e973662707f9644b4fe5f8d18849929723 (diff) | |
parent | dcb98430f6add24c9d54253bd35d35010cc75c23 (diff) | |
download | Qt-63129c8bd21bfdc8110680296bb3bc1ab5e43343.zip Qt-63129c8bd21bfdc8110680296bb3bc1ab5e43343.tar.gz Qt-63129c8bd21bfdc8110680296bb3bc1ab5e43343.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'tools/linguist/shared/xliff.cpp')
-rw-r--r-- | tools/linguist/shared/xliff.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp index 6411426..70724ef 100644 --- a/tools/linguist/shared/xliff.cpp +++ b/tools/linguist/shared/xliff.cpp @@ -53,6 +53,11 @@ #include <QtXml/QXmlParseException> +// The string value is historical and reflects the main purpose: Keeping +// obsolete entries separate from the magic file message (which both have +// no location information, but typically reside at opposite ends of the file). +#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries" + QT_BEGIN_NAMESPACE /** @@ -692,6 +697,9 @@ bool XLIFFHandler::finalizeMessage(bool isPlural) m_cd.appendError(QLatin1String("XLIFF syntax error: Message without source string.")); return false; } + if (m_type == TranslatorMessage::Obsolete && m_refs.size() == 1 + && m_refs.at(0).fileName() == QLatin1String(MAGIC_OBSOLETE_REFERENCE)) + m_refs.clear(); TranslatorMessage msg(m_context, m_sources[0], m_comment, QString(), QString(), -1, m_translations, m_type, isPlural); @@ -761,12 +769,15 @@ bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd) QHash<QString, QList<QString> > contextOrder; QList<QString> fileOrder; foreach (const TranslatorMessage &msg, translator.messages()) { - QHash<QString, QList<TranslatorMessage> > &file = messageOrder[msg.fileName()]; + QString fn = msg.fileName(); + if (fn.isEmpty() && msg.type() == TranslatorMessage::Obsolete) + fn = QLatin1String(MAGIC_OBSOLETE_REFERENCE); + QHash<QString, QList<TranslatorMessage> > &file = messageOrder[fn]; if (file.isEmpty()) - fileOrder.append(msg.fileName()); + fileOrder.append(fn); QList<TranslatorMessage> &context = file[msg.context()]; if (context.isEmpty()) - contextOrder[msg.fileName()].append(msg.context()); + contextOrder[fn].append(msg.context()); context.append(msg); } |