diff options
author | Victor Ostashevsky <ostash@ostash.kiev.ua> | 2010-09-01 08:47:54 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-09-01 09:35:44 (GMT) |
commit | 6f143533666ff88c359cb7ad929e35b4decb556f (patch) | |
tree | e6fc6af621e74865695f6c24b1e9248954348dde /tools/assistant | |
parent | 1f5d88dd327be635966ed9e3811c8803a163b2a4 (diff) | |
download | Qt-6f143533666ff88c359cb7ad929e35b4decb556f.zip Qt-6f143533666ff88c359cb7ad929e35b4decb556f.tar.gz Qt-6f143533666ff88c359cb7ad929e35b4decb556f.tar.bz2 |
Enable loading/generating translations by assistant and linguist tools
QTranslator is installed in tools (qcollectiongenerator, qhelpconverter,
qhelpgenerator, lconvert, lrelease, lupdate).
Build targets that updates .ts files are changed to include strings from
this tools.
Merge-request: 2456
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/qcollectiongenerator/main.cpp | 20 | ||||
-rw-r--r-- | tools/assistant/tools/qhelpconverter/main.cpp | 15 | ||||
-rw-r--r-- | tools/assistant/tools/qhelpgenerator/main.cpp | 18 |
3 files changed, 49 insertions, 4 deletions
diff --git a/tools/assistant/tools/qcollectiongenerator/main.cpp b/tools/assistant/tools/qcollectiongenerator/main.cpp index b3f6bd9..41bf281 100644 --- a/tools/assistant/tools/qcollectiongenerator/main.cpp +++ b/tools/assistant/tools/qcollectiongenerator/main.cpp @@ -49,9 +49,11 @@ #include <QtCore/QDir> #include <QtCore/QMap> #include <QtCore/QFileInfo> -#include <QtCore/QCoreApplication> #include <QtCore/QDateTime> #include <QtCore/QBuffer> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <QtHelp/QHelpEngineCore> #include <QtXml/QXmlStreamReader> @@ -350,6 +352,20 @@ int main(int argc, char *argv[]) bool showHelp = false; bool showVersion = false; + QCoreApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } + for (int i=1; i<argc; ++i) { arg = QString::fromLocal8Bit(argv[i]); if (arg == QLatin1String("-o")) { @@ -410,8 +426,6 @@ int main(int argc, char *argv[]) + fi.baseName() + QLatin1String(".qhc"); } - QCoreApplication app(argc, argv); - fprintf(stdout, "Reading collection config file...\n"); CollectionConfigReader config; config.readData(file.readAll()); diff --git a/tools/assistant/tools/qhelpconverter/main.cpp b/tools/assistant/tools/qhelpconverter/main.cpp index 4b1d815..5ee624d 100644 --- a/tools/assistant/tools/qhelpconverter/main.cpp +++ b/tools/assistant/tools/qhelpconverter/main.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include <QtCore/QFileInfo> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <QtGui/QApplication> #include "conversionwizard.h" @@ -49,6 +52,18 @@ QT_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } ConversionWizard w; if (argc == 2) { diff --git a/tools/assistant/tools/qhelpgenerator/main.cpp b/tools/assistant/tools/qhelpgenerator/main.cpp index a309f42..7ea7154 100644 --- a/tools/assistant/tools/qhelpgenerator/main.cpp +++ b/tools/assistant/tools/qhelpgenerator/main.cpp @@ -44,6 +44,9 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> #include <QtCore/QCoreApplication> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <private/qhelpprojectdata_p.h> @@ -60,6 +63,20 @@ int main(int argc, char *argv[]) bool showVersion = false; bool checkLinks = false; + QCoreApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } + for (int i = 1; i < argc; ++i) { arg = QString::fromLocal8Bit(argv[i]); if (arg == QLatin1String("-o")) { @@ -142,7 +159,6 @@ int main(int argc, char *argv[]) return -1; } - QCoreApplication app(argc, argv); HelpGenerator generator; bool success = true; if (checkLinks) |