diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-13 18:55:05 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-13 18:55:05 (GMT) |
commit | 7d1e48639d6d3897e66779f22fe02d17d6c38707 (patch) | |
tree | 7abc16568274e1f54c976f890e92d73f7a00160c /tools/linguist/lupdate | |
parent | 20e0e7a849d70139f9106f60c78fd0c736ec3c4b (diff) | |
parent | e1b03bac22f87edbbe78eba366966259be6eb0ed (diff) | |
download | Qt-7d1e48639d6d3897e66779f22fe02d17d6c38707.zip Qt-7d1e48639d6d3897e66779f22fe02d17d6c38707.tar.gz Qt-7d1e48639d6d3897e66779f22fe02d17d6c38707.tar.bz2 |
Merge branch '4.6'
Conflicts:
bin/syncqt
doc/src/deployment/deployment.qdoc
src/corelib/io/qfsfileengine_win.cpp
src/corelib/xml/qxmlstream.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
tools/assistant/tools/assistant/centralwidget.cpp
tools/linguist/lupdate/main.cpp
Diffstat (limited to 'tools/linguist/lupdate')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 4 | ||||
-rw-r--r-- | tools/linguist/lupdate/java.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/lupdate.1 | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/lupdate.h | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/main.cpp | 8 | ||||
-rw-r--r-- | tools/linguist/lupdate/merge.cpp | 97 | ||||
-rw-r--r-- | tools/linguist/lupdate/qscript.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/qscript.g | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/ui.cpp | 2 |
9 files changed, 58 insertions, 63 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 857233e..6bd9108 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -1732,7 +1732,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) plural = true; } } - if (!pendingContext.isEmpty()) { + if (!pendingContext.isEmpty() && !prefix.startsWith(strColons)) { QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 3f532d5..27988b04 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/linguist/lupdate/lupdate.1 b/tools/linguist/lupdate/lupdate.1 index a4d2301..2978c99 100644 --- a/tools/linguist/lupdate/lupdate.1 +++ b/tools/linguist/lupdate/lupdate.1 @@ -1,6 +1,6 @@ .TH lupdate 1 "18 October 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*- .\" -.\" Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +.\" Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). .\" All rights reserved. .\" Contact: Nokia Corporation (qt-info@nokia.com) .\" diff --git a/tools/linguist/lupdate/lupdate.h b/tools/linguist/lupdate/lupdate.h index 45eee98..70332cd 100644 --- a/tools/linguist/lupdate/lupdate.h +++ b/tools/linguist/lupdate/lupdate.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 5be13e1..5b4edf1 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -239,18 +239,12 @@ int main(int argc, char **argv) Verbose | // verbose is on by default starting with Qt 4.2 HeuristicSameText | HeuristicSimilarText | HeuristicNumber; int numFiles = 0; - bool standardSyntax = true; bool metTsFlag = false; bool recursiveScan = true; QString extensions = m_defaultExtensions; QSet<QString> extensionsNameFilters; - for (int i = 1; i < argc; ++i) { - if (args.at(i) == QLatin1String("-ts")) - standardSyntax = false; - } - for (int i = 1; i < argc; ++i) { QString arg = args.at(i); if (arg == QLatin1String("-help") diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index fa0dd3d..fffdf9b 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -50,9 +50,6 @@ #include <QtCore/QTextCodec> #include <QtCore/QVector> -typedef QList<TranslatorMessage> TML; -typedef QMap<QString, TranslatorMessage> TMM; - QT_BEGIN_NAMESPACE @@ -63,7 +60,7 @@ static bool isDigitFriendly(QChar c) static int numberLength(const QString &s, int i) { - if (i < s.size() || !s.at(i).isDigit()) + if (i >= s.size() || !s.at(i).isDigit()) return 0; int pos = i; @@ -90,7 +87,7 @@ static QString zeroKey(const QString &key) QString zeroed; bool metSomething = false; - for (int i = 0; i != key.size(); ++i) { + for (int i = 0; i < key.size(); ++i) { int len = numberLength(key, i); if (len > 0) { i += len; @@ -225,31 +222,36 @@ static QString translationAttempt(const QString &oldTranslation, */ int applyNumberHeuristic(Translator &tor) { - TMM translated, untranslated; - TMM::Iterator t, u; - TML all = tor.messages(); - TML::Iterator it; + QMap<QString, QPair<QString, QString> > translated; + QVector<bool> untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - bool hasTranslation = it->isTranslated(); - if (it->type() == TranslatorMessage::Unfinished) { + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + bool hasTranslation = msg.isTranslated(); + if (msg.type() == TranslatorMessage::Unfinished) { if (!hasTranslation) - untranslated.insert(it->context() + QLatin1Char('\n') - + it->sourceText() + QLatin1Char('\n') - + it->comment(), *it); - } else if (hasTranslation && it->translations().count() == 1) { - translated.insert(zeroKey(it->sourceText()), *it); + untranslated[i] = true; + } else if (hasTranslation && msg.translations().count() == 1) { + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) + translated.insert(key, qMakePair(msg.sourceText(), msg.translation())); } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - t = translated.find(zeroKey((*u).sourceText())); - if (t != translated.end() && !t.key().isEmpty() - && t->sourceText() != u->sourceText()) { - u->setTranslation(translationAttempt(t->translation(), t->sourceText(), - u->sourceText())); - inserted++; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + const QString &key = zeroKey(msg.sourceText()); + if (!key.isEmpty()) { + QMap<QString, QPair<QString, QString> >::ConstIterator t = + translated.constFind(key); + if (t != translated.constEnd() && t->first != msg.sourceText()) { + msg.setTranslation(translationAttempt(t->second, t->first, + msg.sourceText())); + inserted++; + } + } } } return inserted; @@ -268,43 +270,42 @@ int applyNumberHeuristic(Translator &tor) int applySameTextHeuristic(Translator &tor) { - TMM translated; - TMM avoid; - TMM::Iterator t; - TML untranslated; - TML::Iterator u; - TML all = tor.messages(); - TML::Iterator it; + QMap<QString, QStringList> translated; + QMap<QString, bool> avoid; // Want a QTreeSet, in fact + QVector<bool> untranslated(tor.messageCount()); int inserted = 0; - for (it = all.begin(); it != all.end(); ++it) { - if (!it->isTranslated()) { - if (it->type() == TranslatorMessage::Unfinished) - untranslated.append(*it); + for (int i = 0; i < tor.messageCount(); ++i) { + const TranslatorMessage &msg = tor.message(i); + if (!msg.isTranslated()) { + if (msg.type() == TranslatorMessage::Unfinished) + untranslated[i] = true; } else { - QString key = it->sourceText(); - t = translated.find(key); - if (t != translated.end()) { + const QString &key = msg.sourceText(); + QMap<QString, QStringList>::ConstIterator t = translated.constFind(key); + if (t != translated.constEnd()) { /* The same source text is translated at least two different ways. Do nothing then. */ - if (t->translations() != it->translations()) { + if (*t != msg.translations()) { translated.remove(key); - avoid.insert(key, *it); + avoid.insert(key, true); } } else if (!avoid.contains(key)) { - translated.insert(key, *it); + translated.insert(key, msg.translations()); } } } - for (u = untranslated.begin(); u != untranslated.end(); ++u) { - QString key = u->sourceText(); - t = translated.find(key); - if (t != translated.end()) { - u->setTranslations(t->translations()); - ++inserted; + for (int i = 0; i < tor.messageCount(); ++i) { + if (untranslated[i]) { + TranslatorMessage &msg = tor.message(i); + QMap<QString, QStringList>::ConstIterator t = translated.constFind(msg.sourceText()); + if (t != translated.constEnd()) { + msg.setTranslations(*t); + ++inserted; + } } } return inserted; diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index 6c94588..6f34c2b 100644 --- a/tools/linguist/lupdate/qscript.cpp +++ b/tools/linguist/lupdate/qscript.cpp @@ -1,7 +1,7 @@ // This file was generated by qlalr - DO NOT EDIT! /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g index 47cd375..a473500 100644 --- a/tools/linguist/lupdate/qscript.g +++ b/tools/linguist/lupdate/qscript.g @@ -1,6 +1,6 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +-- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. -- Contact: Nokia Corporation (qt-info@nokia.com) -- diff --git a/tools/linguist/lupdate/ui.cpp b/tools/linguist/lupdate/ui.cpp index 5392137..9e22922 100644 --- a/tools/linguist/lupdate/ui.cpp +++ b/tools/linguist/lupdate/ui.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** |