summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lrelease
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-02-03 11:57:09 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-02-03 11:57:09 (GMT)
commitead9159c8bfa94004d29c9a0c4b4c93ecce0951e (patch)
tree5b588e4379c8525cb937cdbc0b050fc44761fbae /tools/linguist/lrelease
parent5f11d2125b9cc37768fb8174870ced5934cdacf2 (diff)
parent3838762e4b572017efc42e9f7dbfc43d262807cf (diff)
downloadQt-ead9159c8bfa94004d29c9a0c4b4c93ecce0951e.zip
Qt-ead9159c8bfa94004d29c9a0c4b4c93ecce0951e.tar.gz
Qt-ead9159c8bfa94004d29c9a0c4b4c93ecce0951e.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tools/linguist/lrelease')
-rw-r--r--tools/linguist/lrelease/main.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 7834b06..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,24 +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("error: lrelease encountered project file functionality that is currently not supported.\n"
- "You might want to consider using TS files as input instead of a project file.\n"
- "Try the following syntax:\n"
- " lrelease [options] ts-files [-qm qm-file]\n");
+ QDir proDir(fi.absolutePath());
+ foreach (const QString &trans, translations)
+ if (!releaseTsFile(QFileInfo(proDir, trans).filePath(), cd, removeIdentical))
+ return 1;
}
} else {
if (outputFile.isEmpty()) {