summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2010-01-21 09:30:40 (GMT)
committerck <qt-info@nokia.com>2010-01-21 09:30:40 (GMT)
commit01a54a8d903abddd8b1fbddb1410e56878f41b7c (patch)
tree854c8c3e4c91edbb37460e9693d7b425b425afe3 /tools
parent3d6cfbbc51f82a03cfa69d027defb0d0a3a9af50 (diff)
downloadQt-01a54a8d903abddd8b1fbddb1410e56878f41b7c.zip
Qt-01a54a8d903abddd8b1fbddb1410e56878f41b7c.tar.gz
Qt-01a54a8d903abddd8b1fbddb1410e56878f41b7c.tar.bz2
Assistant: Fix translations.
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/main.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp
index d4f4afd..a13bf2e 100644
--- a/tools/assistant/tools/assistant/main.cpp
+++ b/tools/assistant/tools/assistant/main.cpp
@@ -292,23 +292,26 @@ bool unregisterDocumentation(QHelpEngineCore &collection,
return true;
}
-void setupTranslations(QApplication &app)
+void setupTranslation(const QString &fileName, const QString &dir)
+{
+ QTranslator *translator = new QTranslator(QCoreApplication::instance());
+ if (translator->load(fileName, dir)) {
+ QCoreApplication::installTranslator(translator);
+ } else {
+ qWarning("Could not load translation file %s in directory %s.",
+ qPrintable(fileName), qPrintable(dir));
+ }
+}
+
+void setupTranslations()
{
TRACE_OBJ
const QString& locale = QLocale::system().name();
- QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
-
- QTranslator translator(0);
- translator.load(QLatin1String("assistant_") + locale, resourceDir);
- app.installTranslator(&translator);
-
- QTranslator qtTranslator(0);
- qtTranslator.load(QLatin1String("qt_") + locale, resourceDir);
- app.installTranslator(&qtTranslator);
-
- QTranslator qtHelpTranslator(0);
- qtHelpTranslator.load(QLatin1String("qt_help_") + locale, resourceDir);
- app.installTranslator(&qtHelpTranslator);
+ const QString &resourceDir
+ = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ setupTranslation(QLatin1String("assistant_") + locale, resourceDir);
+ setupTranslation(QLatin1String("qt_") + locale, resourceDir);
+ setupTranslation(QLatin1String("qt_help_") + locale, resourceDir);
}
} // Anonymous namespace.
@@ -413,7 +416,7 @@ int main(int argc, char *argv[])
cachedCollection.setCurrentFilter(cmd.currentFilter());
}
- setupTranslations(a);
+ setupTranslations();
/*
* We need to be careful here: The main window has to be deleted before