On samedi 18 août 2018 19:07:20 CEST Ben Cooksley wrote:
> I debugged this directly on the CI servers and once I had DebugView
> running with Admin privileges that showed the output from the test.
> As it turns out Qt 5.11 introduced the variable above, so for older
> versions we need to set QT_LOGGING_TO_CONSOLE, which i've now done.

Well done! Excellent.

> Looks like this failure is a locale issue?
> https://build.kde.org/view/Frameworks/job/Frameworks%20kxmlgui%20kf5-qt5%20W
> indowsMSVCQt5.10/32/consoleFull

Yes, it shows that setting LANG or LANGUAGE isn't going to change the default 
locale on Windows. Duh, we should have thought of that :-)

The Qt unittests do show that ru_RU exists on Windows (so I have switched to 
that), but not how to set the default locale.
Well, based on tst_qlocale.cpp and qlocale_win.cpp I can infer that something 
like the attached patch would be needed. But that's not something I can really 
code blindly from Linux, include files must be missing etc.
Anyone from kde-windows who can help making this compile, and run 
kxmlgui_unittest to see if it works now?

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
diff --git i/src/kswitchlanguagedialog_p.cpp w/src/kswitchlanguagedialog_p.cpp
index fa97afa9d3..b4831b0c48 100644
--- i/src/kswitchlanguagedialog_p.cpp
+++ w/src/kswitchlanguagedialog_p.cpp
@@ -86,12 +86,18 @@ void initializeLanguages()
     const QByteArray languageCode = getApplicationSpecificLanguage();
 
     if (!languageCode.isEmpty()) {
+#ifdef Q_OS_WIN
+        LCID id = GetThreadLocale();
+        const QString value = languageCode;
+        SetLocaleInfo(id, LOCALE_ILANGUAGE, reinterpret_cast<const wchar_t*>(value.utf16()));
+#else
         QByteArray languages = qgetenv("LANGUAGE");
         if (languages.isEmpty()) {
             qputenv("LANGUAGE", languageCode);
         } else {
             qputenv("LANGUAGE", languageCode + ":" + languages);
         }
+#endif
 
 #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
         // Ideally setting the LANGUAGE would change the default QLocale too

Reply via email to