Changeset 846 for trunk/tools/linguist/lconvert/main.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/linguist/lconvert/main.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 46 46 #include <QtCore/QString> 47 47 #include <QtCore/QStringList> 48 #include <QtCore/QTranslator> 49 #include <QtCore/QLibraryInfo> 48 50 49 51 #include <iostream> 52 53 QT_USE_NAMESPACE 54 55 class LC { 56 Q_DECLARE_TR_FUNCTIONS(LConvert) 57 }; 50 58 51 59 static int usage(const QStringList &args) … … 58 66 loaders += line.arg(format.extension, -5).arg(format.description); 59 67 60 std::cerr << qPrintable( QString(QLatin1String("\nUsage:\n"68 std::cerr << qPrintable(LC::tr("\nUsage:\n" 61 69 " lconvert [options] <infile> [<infile>...]\n\n" 62 70 "lconvert is part of Qt's Linguist tool chain. It can be used as a\n" … … 120 128 " 1 on command line parse failures\n" 121 129 " 2 on read failures\n" 122 " 3 on write failures\n") ).arg(loaders));130 " 3 on write failures\n").arg(loaders)); 123 131 return 1; 124 132 } … … 133 141 { 134 142 QCoreApplication app(argc, argv); 143 #ifndef Q_OS_WIN32 144 QTranslator translator; 145 QTranslator qtTranslator; 146 QString sysLocale = QLocale::system().name(); 147 QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); 148 if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir) 149 && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { 150 app.installTranslator(&translator); 151 app.installTranslator(&qtTranslator); 152 } 153 #endif // Q_OS_WIN32 154 135 155 QStringList args = app.arguments(); 136 137 156 QList<File> inFiles; 138 157 QString inFormat(QLatin1String("auto")); … … 239 258 240 259 if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) { 241 qWarning()<< qPrintable(cd.error());260 std::cerr << qPrintable(cd.error()); 242 261 return 2; 243 262 } … … 247 266 Translator tr2; 248 267 if (!tr2.load(inFiles[i].name, cd, inFiles[i].format)) { 249 qWarning()<< qPrintable(cd.error());268 std::cerr << qPrintable(cd.error()); 250 269 return 2; 251 270 } … … 272 291 tr.normalizeTranslations(cd); 273 292 if (!cd.errors().isEmpty()) { 274 qWarning("%s", qPrintable(cd.error()));293 std::cerr << qPrintable(cd.error()); 275 294 cd.clearErrors(); 276 295 } 277 296 if (!tr.save(outFileName, cd, outFormat)) { 278 qWarning("%s", qPrintable(cd.error()));297 std::cerr << qPrintable(cd.error()); 279 298 return 3; 280 299 }
Note:
See TracChangeset
for help on using the changeset viewer.