summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorVictor Ostashevsky <ostash@ostash.kiev.ua>2010-09-01 08:47:54 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-09-01 09:35:44 (GMT)
commit6f143533666ff88c359cb7ad929e35b4decb556f (patch)
treee6fc6af621e74865695f6c24b1e9248954348dde /tools/linguist
parent1f5d88dd327be635966ed9e3811c8803a163b2a4 (diff)
downloadQt-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/linguist')
-rw-r--r--tools/linguist/lconvert/main.cpp13
-rw-r--r--tools/linguist/lrelease/main.cpp8
-rw-r--r--tools/linguist/lupdate/main.cpp12
3 files changed, 31 insertions, 2 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 094406c..e7c1d9a 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -45,6 +45,8 @@
#include <QtCore/QDebug>
#include <QtCore/QString>
#include <QtCore/QStringList>
+#include <QtCore/QTranslator>
+#include <QtCore/QLibraryInfo>
#include <iostream>
@@ -134,8 +136,17 @@ struct File
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
- QStringList args = app.arguments();
+ QTranslator translator;
+ QTranslator qtTranslator;
+ QString sysLocale = QLocale::system().name();
+ QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+ && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+ app.installTranslator(&translator);
+ app.installTranslator(&qtTranslator);
+ }
+ QStringList args = app.arguments();
QList<File> inFiles;
QString inFormat(QLatin1String("auto"));
QString outFileName;
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index b5cff90..003d379 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -181,8 +181,14 @@ int main(int argc, char **argv)
#else
QCoreApplication app(argc, argv);
QTranslator translator;
- if (translator.load(QLatin1String("lrelease_") + QLocale::system().name()))
+ QTranslator qtTranslator;
+ QString sysLocale = QLocale::system().name();
+ QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+ && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
+ app.installTranslator(&qtTranslator);
+ }
#endif
ConversionData cd;
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index a575192..0ff5288 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -52,6 +52,8 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextCodec>
+#include <QtCore/QTranslator>
+#include <QtCore/QLibraryInfo>
#include <iostream>
@@ -410,6 +412,16 @@ static void processProjects(
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
+ QTranslator translator;
+ QTranslator qtTranslator;
+ QString sysLocale = QLocale::system().name();
+ QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+ && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+ app.installTranslator(&translator);
+ app.installTranslator(&qtTranslator);
+ }
+
m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml");
QStringList args = app.arguments();