From d4d3d6fdba1e847fb174cd6b19efb3b10e273118 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 17 Jan 2024 18:54:45 +0100 Subject: [PATCH] Tidy up, check platform and add comments in qlocale_win.cpp MS says we should stop using LCID, so make a note about that. This file should only be compiled when Q_OS_WIN is defined, so don't bother with #if-ery to check that. Remove two redundant forward-declarations. Record what qt_localeFromLCID is for - undocumented private API exported for the use of a platform plugin - since that isn't immediately obvious to someone only looking at QLocale. Change-Id: I81ad945bb92d4f81a3ca2aaf97a945635b137a2e Reviewed-by: Ivan Solovev --- src/corelib/text/qlocale_win.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 89779bcd2f..e238b67d03 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -14,10 +14,9 @@ #include -#ifdef Q_OS_WIN -# include -# include -#endif +// TODO QTBUG-121193: port away from the use of LCID to always use names. +#include +#include #if QT_CONFIG(cpp_winrt) # include @@ -67,8 +66,6 @@ static auto getDefaultWinId() } static QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT); -static QString winIso639LangName(LCID id = LOCALE_USER_DEFAULT); -static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT); #ifndef QT_NO_SYSTEMLOCALE @@ -1174,6 +1171,7 @@ static QByteArray getWinLocaleName(LCID id) return std::move(resultusage).toLatin1(); } +// Helper for plugins/platforms/windows/ Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id) { return QLocale(QString::fromLatin1(getWinLocaleName(id)));