summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-19 03:13:15 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-19 03:13:15 (GMT)
commit398d37e78d0026b832e1676de9bd33b5441bfd9e (patch)
tree69cfa40370d5b837ac310a463f898471fa949f3a /tools/linguist
parentbfe06c2531fa47d4d417ec22bdb184b06ad0f073 (diff)
parent80cd617b05ad3e647c87dc063d40cde0617344ca (diff)
downloadQt-398d37e78d0026b832e1676de9bd33b5441bfd9e.zip
Qt-398d37e78d0026b832e1676de9bd33b5441bfd9e.tar.gz
Qt-398d37e78d0026b832e1676de9bd33b5441bfd9e.tar.bz2
Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into kinetic-declarativeui
Conflicts: src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/lrelease/lrelease.pro13
-rw-r--r--tools/linguist/lrelease/main.cpp127
-rw-r--r--tools/linguist/phrasebooks/french.qph40
-rw-r--r--tools/linguist/shared/proparserutils.h25
-rw-r--r--tools/linguist/shared/qm.cpp2
-rw-r--r--tools/linguist/shared/translator.cpp10
-rw-r--r--tools/linguist/shared/translator.h12
7 files changed, 200 insertions, 29 deletions
diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro
index 01091b3..e4c18ee 100644
--- a/tools/linguist/lrelease/lrelease.pro
+++ b/tools/linguist/lrelease/lrelease.pro
@@ -2,21 +2,14 @@ TEMPLATE = app
TARGET = lrelease
DESTDIR = ../../../bin
-QT -= gui
-
-CONFIG += qt warn_on console
-CONFIG -= app_bundle
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
SOURCES += main.cpp
+include(../../../src/tools/bootstrap/bootstrap.pri)
include(../shared/formats.pri)
include(../shared/proparser.pri)
+win32-msvc*:LIBS += advapi32.lib # for qsettings_win.cpp
+
target.path=$$[QT_INSTALL_BINS]
INSTALLS += target
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index 742c2e6..c45459a 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -42,7 +42,10 @@
#include "translator.h"
#include "proreader.h"
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QCoreApplication>
+#include <QtCore/QTranslator>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
@@ -51,7 +54,14 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
-#include <QtCore/QTranslator>
+
+#ifdef QT_BOOTSTRAPPED
+static void initBinaryDir(
+#ifndef Q_OS_WIN
+ const char *argv0
+#endif
+ );
+#endif
static void printOut(const QString & out)
{
@@ -157,11 +167,18 @@ static bool releaseTsFile(const QString& tsFileName,
int main(int argc, char **argv)
{
+#ifdef QT_BOOTSTRAPPED
+ initBinaryDir(
+#ifndef Q_OS_WIN
+ argv[0]
+#endif
+ );
+#else
QCoreApplication app(argc, argv);
- QStringList args = app.arguments();
QTranslator translator;
if (translator.load(QLatin1String("lrelease_") + QLocale::system().name()))
app.installTranslator(&translator);
+#endif
ConversionData cd;
cd.m_verbose = true; // the default is true starting with Qt 4.2
@@ -171,50 +188,50 @@ int main(int argc, char **argv)
QString outputFile;
for (int i = 1; i < argc; ++i) {
- if (args[i] == QLatin1String("-compress")) {
+ if (!strcmp(argv[i], "-compress")) {
cd.m_saveMode = SaveStripped;
continue;
- } else if (args[i] == QLatin1String("-idbased")) {
+ } else if (!strcmp(argv[i], "-idbased")) {
cd.m_idBased = true;
continue;
- } else if (args[i] == QLatin1String("-nocompress")) {
+ } else if (!strcmp(argv[i], "-nocompress")) {
cd.m_saveMode = SaveEverything;
continue;
- } else if (args[i] == QLatin1String("-removeidentical")) {
+ } else if (!strcmp(argv[i], "-removeidentical")) {
removeIdentical = true;
continue;
- } else if (args[i] == QLatin1String("-nounfinished")) {
+ } else if (!strcmp(argv[i], "-nounfinished")) {
cd.m_ignoreUnfinished = true;
continue;
- } else if (args[i] == QLatin1String("-markuntranslated")) {
+ } else if (!strcmp(argv[i], "-markuntranslated")) {
if (i == argc - 1) {
printUsage();
return 1;
}
- cd.m_unTrPrefix = args[++i];
- } else if (args[i] == QLatin1String("-silent")) {
+ cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]);
+ } else if (!strcmp(argv[i], "-silent")) {
cd.m_verbose = false;
continue;
- } else if (args[i] == QLatin1String("-verbose")) {
+ } else if (!strcmp(argv[i], "-verbose")) {
cd.m_verbose = true;
continue;
- } else if (args[i] == QLatin1String("-version")) {
+ } else if (!strcmp(argv[i], "-version")) {
printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) );
return 0;
- } else if (args[i] == QLatin1String("-qm")) {
+ } else if (!strcmp(argv[i], "-qm")) {
if (i == argc - 1) {
printUsage();
return 1;
}
- outputFile = args[++i];
- } else if (args[i] == QLatin1String("-help")) {
+ outputFile = QString::fromLocal8Bit(argv[++i]);
+ } else if (!strcmp(argv[i], "-help")) {
printUsage();
return 0;
- } else if (args[i].startsWith(QLatin1Char('-'))) {
+ } else if (argv[i][0] == '-') {
printUsage();
return 1;
} else {
- inputFiles << args[i];
+ inputFiles << QString::fromLocal8Bit(argv[i]);
}
}
@@ -261,3 +278,79 @@ int main(int argc, char **argv)
return 0;
}
+
+#ifdef QT_BOOTSTRAPPED
+
+#ifdef Q_OS_WIN
+# include <windows.h>
+#endif
+
+static QString binDir;
+
+static void initBinaryDir(
+#ifndef Q_OS_WIN
+ const char *_argv0
+#endif
+ )
+{
+#ifdef Q_OS_WIN
+ wchar_t module_name[MAX_PATH];
+ GetModuleFileName(0, module_name, MAX_PATH);
+ QFileInfo filePath = QString::fromWCharArray(module_name);
+ binDir = filePath.filePath();
+#else
+ QString argv0 = QFile::decodeName(QByteArray(_argv0));
+ QString absPath;
+
+ if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
+ /*
+ If argv0 starts with a slash, it is already an absolute
+ file path.
+ */
+ absPath = argv0;
+ } else if (argv0.contains(QLatin1Char('/'))) {
+ /*
+ If argv0 contains one or more slashes, it is a file path
+ relative to the current directory.
+ */
+ absPath = QDir::current().absoluteFilePath(argv0);
+ } else {
+ /*
+ Otherwise, the file path has to be determined using the
+ PATH environment variable.
+ */
+ QByteArray pEnv = qgetenv("PATH");
+ QDir currentDir = QDir::current();
+ QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":"));
+ for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) {
+ if ((*p).isEmpty())
+ continue;
+ QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0);
+ QFileInfo candidate_fi(candidate);
+ if (candidate_fi.exists() && !candidate_fi.isDir()) {
+ binDir = candidate_fi.canonicalPath();
+ return;
+ }
+ }
+ return;
+ }
+
+ QFileInfo fi(absPath);
+ if (fi.exists())
+ binDir = fi.canonicalPath();
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+// The name is hard-coded in QLibraryInfo
+QString qmake_libraryInfoFile()
+{
+ if (binDir.isEmpty())
+ return QString();
+ return QDir(binDir).filePath(QString::fromLatin1("qt.conf"));
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_BOOTSTRAPPED
diff --git a/tools/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph
index a34effe..d710abd 100644
--- a/tools/linguist/phrasebooks/french.qph
+++ b/tools/linguist/phrasebooks/french.qph
@@ -1351,8 +1351,8 @@
<target>Impossible de créer le répertoire : %1</target>
</phrase>
<phrase>
- <source>&amp;Case sensitive</source>
- <target>&amp;Sensible à la casse</target>
+ <source></source>
+ <target></target>
</phrase>
<phrase>
<source>Whole &amp;words</source>
@@ -1366,4 +1366,40 @@
<source>Fonts</source>
<target>Polices</target>
</phrase>
+<phrase>
+ <source>Insert</source>
+ <target>Insérer</target>
+</phrase>
+<phrase>
+ <source>Size</source>
+ <target>Taille</target>
+</phrase>
+<phrase>
+ <source>List View</source>
+ <target>Affichage liste</target>
+</phrase>
+<phrase>
+ <source>Read-only</source>
+ <target>Lecture seule</target>
+</phrase>
+<phrase>
+ <source>Minimize</source>
+ <target>Réduire</target>
+</phrase>
+<phrase>
+ <source>Maximize</source>
+ <target>Maximiser</target>
+</phrase>
+<phrase>
+ <source>Retry</source>
+ <target>Réessayer</target>
+</phrase>
+<phrase>
+ <source>Dock</source>
+ <target>Attacher</target>
+</phrase>
+<phrase>
+ <source>&amp;Redo</source>
+ <target>&amp;Rétablir</target>
+</phrase>
</QPH>
diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h
index 9a83733..1ed3d6c 100644
--- a/tools/linguist/shared/proparserutils.h
+++ b/tools/linguist/shared/proparserutils.h
@@ -43,10 +43,35 @@
#define PROPARSERUTILS_H
#include <QtCore/QDir>
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QLibraryInfo>
+#endif
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+// this is a stripped down version of the one found in QtCore
+class QLibraryInfo
+{
+public:
+ enum LibraryLocation
+ {
+ PrefixPath,
+ DocumentationPath,
+ HeadersPath,
+ LibrariesPath,
+ BinariesPath,
+ PluginsPath,
+ DataPath,
+ TranslationsPath,
+ SettingsPath,
+ DemosPath,
+ ExamplesPath
+ };
+ static QString location(LibraryLocation);
+};
+#endif
+
// Pre- and postcondition macros
#define PRE(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)
#define POST(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index 99aedef..e4c26bc 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -41,7 +41,9 @@
#include "translator.h"
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QCoreApplication>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index bc27daf..05fc6e5 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -56,6 +56,16 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+QString QObject::tr(const char *sourceText, const char *, int n)
+{
+ QString ret = QString::fromLatin1(sourceText);
+ if (n >= 0)
+ ret.replace(QLatin1String("%n"), QString::number(n));
+ return ret;
+}
+#endif
+
Translator::Translator() :
m_codecName("ISO-8859-1"),
m_locationsType(AbsoluteLocations)
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index eec704a..f29317b 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -54,6 +54,18 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+struct QObject {
+ static QString tr(const char *sourceText, const char * = 0, int n = -1);
+};
+struct QCoreApplication : public QObject {
+ enum Encoding { CodecForTr };
+ static QString translate(const char *, const char *sourceText, const char * = 0,
+ Encoding = CodecForTr, int n = -1)
+ { return tr(sourceText, 0, n); }
+};
+#endif
+
class QIODevice;
// A struct of "interesting" data passed to and from the load and save routines