summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lrelease
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-01-26 18:19:33 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-01-27 15:12:31 (GMT)
commitb0a454fd09e0cbf74304aabd160ea25c2c83b4b9 (patch)
tree1769a83d39bd8309cd552ab733804443e7cbbd95 /tools/linguist/lrelease
parent03e114b11ee5cd51e0b9151e0c728fe370578d53 (diff)
downloadQt-b0a454fd09e0cbf74304aabd160ea25c2c83b4b9.zip
Qt-b0a454fd09e0cbf74304aabd160ea25c2c83b4b9.tar.gz
Qt-b0a454fd09e0cbf74304aabd160ea25c2c83b4b9.tar.bz2
unshare pro post-processing code
lrelease needs only the TRANSLATIONS value anyway, so there is hardly anything to share for real
Diffstat (limited to 'tools/linguist/lrelease')
-rw-r--r--tools/linguist/lrelease/main.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index c418bcc..266474e 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "translator.h"
-#include "proreader.h"
+#include "profileevaluator.h"
#ifndef QT_BOOTSTRAPPED
#include <QtCore/QCoreApplication>
@@ -246,21 +246,31 @@ int main(int argc, char **argv)
foreach (const QString &inputFile, inputFiles) {
if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive)
|| inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) {
- QHash<QByteArray, QStringList> varMap;
- bool ok = evaluateProFile(inputFile, cd.isVerbose(), &varMap);
- if (ok) {
- QStringList translations = varMap.value("TRANSLATIONS");
- if (translations.isEmpty()) {
- qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in"
- " project file '%s'\n",
- qPrintable(inputFile));
- } else {
- foreach (const QString &trans, translations)
- if (!releaseTsFile(trans, cd, removeIdentical))
- return 1;
- }
+ QFileInfo fi(inputFile);
+ ProFile pro(fi.absoluteFilePath());
+
+ ProFileEvaluator visitor;
+ visitor.setVerbose(cd.isVerbose());
+
+ if (!visitor.queryProFile(&pro)) {
+ qWarning("lrelease error: cannot read project file '%s'.", qPrintable(inputFile));
+ continue;
+ }
+ if (!visitor.accept(&pro)) {
+ qWarning("lrelease error: cannot process project file '%s'.", qPrintable(inputFile));
+ continue;
+ }
+
+ QStringList translations = visitor.values(QLatin1String("TRANSLATIONS"));
+ if (translations.isEmpty()) {
+ qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in"
+ " project file '%s'\n",
+ qPrintable(inputFile));
} else {
- qWarning("lrelease error: cannot read project file %s.", qPrintable(inputFile));
+ QDir proDir(fi.absolutePath());
+ foreach (const QString &trans, translations)
+ if (!releaseTsFile(QFileInfo(proDir, trans).filePath(), cd, removeIdentical))
+ return 1;
}
} else {
if (outputFile.isEmpty()) {