Commit 575aa068 authored by Eike Ziller's avatar Eike Ziller
Browse files

Fix Qt Creator using wrong UI language.

Qt 4.8 introduced QLocale::uiLanguages() and changed the behavior of
QLocale::system().name(). We now retrieve the list of preferred
uiLanguages when building against 4.8, and look for the first language
that we have translations for.

Task-number: QTCREATORBUG-7134
Change-Id: I90cdb6182732a013dc431b61a7976900e48e0d31
Reviewed-by: default avatarOswald Buddenhagen <>
parent ae070f32
......@@ -234,10 +234,6 @@ int main(int argc, char **argv)
QtSystemExceptionHandler systemExceptionHandler;
QTranslator translator;
QTranslator qtTranslator;
QString locale = QLocale::system().name();
// Manually determine -settingspath command line option
// We can't use the regular way of the plugin manager, because that needs to parse pluginspecs
// but the settings path can influence which plugins are enabled
......@@ -273,9 +269,20 @@ int main(int argc, char **argv)
locale = settings->value("General/OverrideLanguage", locale).toString();
QTranslator translator;
QTranslator qtTranslator;
QStringList uiLanguages;
#if QT_VERSION >= 0x040800
uiLanguages = QLocale::system().uiLanguages();
uiLanguages << QLocale::system().name();
QString overrideLanguage = settings->value("General/OverrideLanguage").toString();
if (!overrideLanguage.isEmpty())
const QString &creatorTrPath = QCoreApplication::applicationDirPath()
+ QLatin1String(SHARE_PATH "/translations");
foreach (const QString &locale, uiLanguages) {
if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
......@@ -284,8 +291,15 @@ int main(int argc, char **argv)
app.setProperty("qtc_locale", locale);
} else {
translator.load(QString()); // unload()
} else if (locale == QLatin1String("C") /* overrideLanguage == "English" */) {
// use built-in
} else if (locale.startsWith(QLatin1String("en")) /* "English" is built-in */) {
// use built-in
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment