diff -r 56cd8111b7f7 -r 41300fa6a67c tools/linguist/shared/qph.cpp --- a/tools/linguist/shared/qph.cpp Tue Jan 26 12:42:25 2010 +0200 +++ b/tools/linguist/shared/qph.cpp Tue Feb 02 00:43:10 2010 +0200 @@ -81,14 +81,20 @@ while (!atEnd()) { readNext(); if (isStartElement()) { - if (name() == QLatin1String("source")) + if (name() == QLatin1String("source")) { m_currentField = SourceField; - else if (name() == QLatin1String("target")) + } else if (name() == QLatin1String("target")) { m_currentField = TargetField; - else if (name() == QLatin1String("definition")) + } else if (name() == QLatin1String("definition")) { m_currentField = DefinitionField; - else + } else { m_currentField = NoField; + if (name() == QLatin1String("QPH")) { + QXmlStreamAttributes atts = attributes(); + translator.setLanguageCode(atts.value(QLatin1String("language")).toString()); + translator.setSourceLanguageCode(atts.value(QLatin1String("sourcelanguage")).toString()); + } + } } else if (isWhiteSpace()) { // ignore these } else if (isCharacters()) { @@ -104,7 +110,7 @@ TranslatorMessage msg; msg.setSourceText(m_currentSource); msg.setTranslation(m_currentTarget); - msg.setTranslatorComment(m_currentDefinition); + msg.setComment(m_currentDefinition); translator.append(msg); m_currentSource.clear(); m_currentTarget.clear(); @@ -157,7 +163,14 @@ { QTextStream t(&dev); t.setCodec(QTextCodec::codecForName("UTF-8")); - t << "\n\n"; + t << "\n\n"; foreach (const TranslatorMessage &msg, translator.messages()) { t << "\n"; t << " " << protect(msg.sourceText()) << "\n"; @@ -166,9 +179,8 @@ QChar(Translator::TextVariantSeparator)); t << " " << protect(str) << "\n"; - if (!msg.context().isEmpty() || !msg.comment().isEmpty()) - t << " " << msg.context() << msg.comment() - << "\n"; + if (!msg.comment().isEmpty()) + t << " " << protect(msg.comment()) << "\n"; t << "\n"; } t << "\n";