summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lconvert/main.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-09-02 01:00:14 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-09-02 01:00:14 (GMT)
commit63eab5ef720936dbb5ee76686c6558e18a79e587 (patch)
tree920a29827e6fb83431e90c160616ca73924b455a /tools/linguist/lconvert/main.cpp
parent661e237be622a5f7886cee7c06f9daa73d4a07d7 (diff)
parente3a76875d1eea19c29fd6c8dec4e0db9252c2d29 (diff)
downloadQt-63eab5ef720936dbb5ee76686c6558e18a79e587.zip
Qt-63eab5ef720936dbb5ee76686c6558e18a79e587.tar.gz
Qt-63eab5ef720936dbb5ee76686c6558e18a79e587.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tools/linguist/lconvert/main.cpp')
-rw-r--r--tools/linguist/lconvert/main.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 094406c..d691548 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -45,11 +45,17 @@
#include <QtCore/QDebug>
#include <QtCore/QString>
#include <QtCore/QStringList>
+#include <QtCore/QTranslator>
+#include <QtCore/QLibraryInfo>
#include <iostream>
QT_USE_NAMESPACE
+class LC {
+ Q_DECLARE_TR_FUNCTIONS(LConvert)
+};
+
static int usage(const QStringList &args)
{
Q_UNUSED(args);
@@ -59,7 +65,7 @@ static int usage(const QStringList &args)
foreach (Translator::FileFormat format, Translator::registeredFileFormats())
loaders += line.arg(format.extension, -5).arg(format.description);
- std::cerr << qPrintable(QString(QLatin1String("\nUsage:\n"
+ std::cerr << qPrintable(LC::tr("\nUsage:\n"
" lconvert [options] <infile> [<infile>...]\n\n"
"lconvert is part of Qt's Linguist tool chain. It can be used as a\n"
"stand-alone tool to convert and filter translation data files.\n"
@@ -121,7 +127,7 @@ static int usage(const QStringList &args)
" 0 on success\n"
" 1 on command line parse failures\n"
" 2 on read failures\n"
- " 3 on write failures\n")).arg(loaders));
+ " 3 on write failures\n").arg(loaders));
return 1;
}
@@ -134,8 +140,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;