diff --git a/autotests/kxmlgui_unittest.cpp b/autotests/kxmlgui_unittest.cpp --- a/autotests/kxmlgui_unittest.cpp +++ b/autotests/kxmlgui_unittest.cpp @@ -1086,6 +1086,7 @@ KDEPrivate::initializeLanguages(); QCOMPARE(QLocale::system().language(), QLocale::Russian); + QCOMPARE(QLocale::system().monthName(1), QString::fromUtf8("января")); KDEPrivate::setApplicationSpecificLanguage("wa"); KDEPrivate::initializeLanguages(); diff --git a/src/kswitchlanguagedialog_p.cpp b/src/kswitchlanguagedialog_p.cpp --- a/src/kswitchlanguagedialog_p.cpp +++ b/src/kswitchlanguagedialog_p.cpp @@ -80,18 +80,24 @@ } } +void addSetEnvVar(const char *envVarName, const QByteArray &value) +{ + const QByteArray envVarValue = qgetenv(envVarName); + if (envVarValue.isEmpty()) { + qputenv(envVarName, value); + } else { + qputenv(envVarName, value + ':' + envVarValue); + } +} + void initializeLanguages() { const QByteArray languageCode = getApplicationSpecificLanguage(); if (!languageCode.isEmpty()) { - QByteArray languages = qgetenv("LANGUAGE"); - if (languages.isEmpty()) { - qputenv("LANGUAGE", languageCode); - } else { - qputenv("LANGUAGE", languageCode + ':' + languages); - } - // Ideally setting the LANGUAGE would change the default QLocale too + addSetEnvVar("LANGUAGE", languageCode); + addSetEnvVar("LC_ALL", languageCode); + // Ideally setting LANGUAGE/LC_ALL would change the default QLocale too // but unfortunately this is too late since the QCoreApplication constructor // already created a QLocale at this stage so we need to set the reset it // by triggering the creation and destruction of a QSystemLocale