X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=058b4b93b346f7f0c815e3b79512ae388999f9c8;hb=9e798c47eac3f01295016b6f27a48e787a072c25;hp=c60f5ec1381036cbbe0d40d88b4ca645c0140124;hpb=4c80eeb2d07b5ca75fd399b51c939961fdff1670;p=quassel.git diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index c60f5ec1..058b4b93 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -23,6 +23,8 @@ #include #include #if !defined Q_OS_WIN32 && !defined Q_OS_MAC +# include +# include # include #endif @@ -495,32 +497,15 @@ void Quassel::loadTranslation(const QLocale &locale) quasselTranslator->setObjectName("QuasselTr"); qApp->installTranslator(quasselTranslator); -#if QT_VERSION >= 0x040800 - bool success = qtTranslator->load(locale, QString("qt_%1"), translationDirPath()); +#if QT_VERSION >= 0x040800 && !defined Q_OS_MAC + bool success = qtTranslator->load(locale, QString("qt_"), translationDirPath()); if (!success) qtTranslator->load(locale, QString("qt_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); quasselTranslator->load(locale, QString(""), translationDirPath()); #else - QString localeName = locale.name(); - - // if the user did not specify a language in the settings, the system locale - // is used, but Qt < 4.8 does not respect language settings. This bit is - // based on QLocale::uiLanguages() as in Qt 4.8.3 - if (locale == QLocale::system()) { - // FIXME: does it make sense to set the locale to the system locale? - QLocale::setDefault(locale); - QVariant res = QSystemLocale().query(QSystemLocale::UILanguages, QVariant()); - if (!res.isNull()) { - QString newName = res.toStringList()[0]; - if (!newName.isEmpty()) { - localeName = newName.replace('-', "_"); // silly Qt. - } - } - } - - bool success = qtTranslator->load(QString("qt_%1").arg(localeName), translationDirPath()); + bool success = qtTranslator->load(QString("qt_%1").arg(locale.name()), translationDirPath()); if (!success) - qtTranslator->load(QString("qt_%1").arg(localeName), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - quasselTranslator->load(QString("%1").arg(localeName), translationDirPath()); + qtTranslator->load(QString("qt_%1").arg(locale.name()), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + quasselTranslator->load(QString("%1").arg(locale.name()), translationDirPath()); #endif }