From bebb15592561e1e38a5e7fb5fc25b1d50d3487f9 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin <daniel.molkentin@nokia.com> Date: Wed, 10 Jun 2009 13:27:05 +0200 Subject: [PATCH] Also search for Qt tr cataloges in the Creator tr dir. Add qt_help cataloge. The qt_help cataloge is required to fully translate the help plugin. The additional lookup is mandated by the binary packages, where the translations are simply put in Creatrors translation directories and the Qt translation path is invalid. Reviewed-by: con <qtc-committer@nokia.com> --- src/app/main.cpp | 12 +++++++----- src/plugins/designer/formeditorplugin.cpp | 9 ++++++--- src/plugins/help/helpplugin.cpp | 13 ++++++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 5199c7c7e64..1cb2b8e8e95 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -217,11 +217,13 @@ int main(int argc, char **argv) QTranslator translator; QTranslator qtTranslator; const QString &locale = QLocale::system().name(); - if (translator.load(QLatin1String("qtcreator_") + locale, - QCoreApplication::applicationDirPath() - + QLatin1String(SHARE_PATH "/translations"))) { - if (qtTranslator.load(QLatin1String("qt_") + locale, - QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { + const QString &creatorTrPath = QCoreApplication::applicationDirPath() + + QLatin1String(SHARE_PATH "/translations"); + if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) { + const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString &qtTrFile = QLatin1String("qt_") + locale; + // Binary installer puts Qt tr files into creatorTrPath + if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, creatorTrPath)) { app.installTranslator(&translator); app.installTranslator(&qtTranslator); app.setProperty("qtc_locale", locale); diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index 8962f2f714a..6227c0ff285 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -121,9 +121,12 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) QString locale = qApp->property("qtc_locale").toString(); if (!locale.isEmpty()) { QTranslator *qtr = new QTranslator(this); - qtr->load(QLatin1String("designer_") + locale, - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - qApp->installTranslator(qtr); + const QString &creatorTrPath = + Core::ICore::instance()->resourcePath() + QLatin1String("/translations"); + const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString &trFile = QLatin1String("designer_") + locale; + if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) + qApp->installTranslator(qtr); } error->clear(); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 726d3d47d12..ae2baa25a7c 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -141,9 +141,16 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) QString locale = qApp->property("qtc_locale").toString(); if (!locale.isEmpty()) { QTranslator *qtr = new QTranslator(this); - qtr->load(QLatin1String("assistant_") + locale, - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - qApp->installTranslator(qtr); + QTranslator *qhelptr = new QTranslator(this); + const QString &creatorTrPath = + Core::ICore::instance()->resourcePath() + QLatin1String("/translations"); + const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString &trFile = QLatin1String("assistant_") + locale; + const QString &helpTrFile = QLatin1String("qt_help_") + locale; + if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) + qApp->installTranslator(qtr); + if (qhelptr->load(helpTrFile, qtTrPath) || qhelptr->load(helpTrFile, creatorTrPath)) + qApp->installTranslator(qhelptr); } #ifndef QT_NO_WEBKIT -- GitLab