forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -217,11 +217,13 @@ int main(int argc, char **argv)
|
|||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
const QString &locale = QLocale::system().name();
|
const QString &locale = QLocale::system().name();
|
||||||
if (translator.load(QLatin1String("qtcreator_") + locale,
|
const QString &creatorTrPath = QCoreApplication::applicationDirPath()
|
||||||
QCoreApplication::applicationDirPath()
|
+ QLatin1String(SHARE_PATH "/translations");
|
||||||
+ QLatin1String(SHARE_PATH "/translations"))) {
|
if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) {
|
||||||
if (qtTranslator.load(QLatin1String("qt_") + locale,
|
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||||
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(&translator);
|
||||||
app.installTranslator(&qtTranslator);
|
app.installTranslator(&qtTranslator);
|
||||||
app.setProperty("qtc_locale", locale);
|
app.setProperty("qtc_locale", locale);
|
||||||
|
|||||||
@@ -121,9 +121,12 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
QString locale = qApp->property("qtc_locale").toString();
|
QString locale = qApp->property("qtc_locale").toString();
|
||||||
if (!locale.isEmpty()) {
|
if (!locale.isEmpty()) {
|
||||||
QTranslator *qtr = new QTranslator(this);
|
QTranslator *qtr = new QTranslator(this);
|
||||||
qtr->load(QLatin1String("designer_") + locale,
|
const QString &creatorTrPath =
|
||||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
Core::ICore::instance()->resourcePath() + QLatin1String("/translations");
|
||||||
qApp->installTranslator(qtr);
|
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();
|
error->clear();
|
||||||
|
|||||||
@@ -141,9 +141,16 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
QString locale = qApp->property("qtc_locale").toString();
|
QString locale = qApp->property("qtc_locale").toString();
|
||||||
if (!locale.isEmpty()) {
|
if (!locale.isEmpty()) {
|
||||||
QTranslator *qtr = new QTranslator(this);
|
QTranslator *qtr = new QTranslator(this);
|
||||||
qtr->load(QLatin1String("assistant_") + locale,
|
QTranslator *qhelptr = new QTranslator(this);
|
||||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
const QString &creatorTrPath =
|
||||||
qApp->installTranslator(qtr);
|
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
|
#ifndef QT_NO_WEBKIT
|
||||||
|
|||||||
Reference in New Issue
Block a user