Go to file
Tor Arne Vestbø d8158c6c93 macOS: Be honest about the system locale
The system locale of a macOS application is not affected by environment
variables like LANG. Yet, we were reporting a name determined from
environment variables as the fallbackUiLocale(), rather than one based
on the language and country of the actual system locale.

This lead, via the usual CLDR likely-subtag fallback, to claiming the
system locale's name, language, script and country were those obtained
from these environment variables, even when they were at odds with the
actual locale being used by the system, which was being used for some
queries.

Worse yet, any data not supplied by these queries was being obtained
from the same CLDR locale as the name, making for an inconsistent mix
of locale data.

While we cannot avoid the likely-subtag fallback step for fallback
data, it is more consistent to use the actual system locale's name
as start-point for that fallback.

At the same time, add support for the language, script and country
queries, so that the QLocale::system() describes itself faithfully,
instead of claiming to be the locale that results from that fallback.

If we want to support LANG or other environment variable overrides,
they should be handled by the layer above the system locale, by
changing the default locale of the Qt application, as if the user
had called QLocale::setDefault().

[ChangeLog][QtCore][QLocale] QLocale::system() on macOS no longer
pretends to support LANG or other environment variables as overrides,
as this is not a feature that the system locale on macOS supports.
To override the locale of an application, use QLocale::setDefault(),
or pass -AppleLocale en_US.

Fixes: QTBUG-90971
Change-Id: Ibdaf5ff9a2050f61233a88eabf3c29094f7757f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 15:01:45 +01:00
.github/workflows Github Actions: many minor updates 2021-01-22 18:48:54 +01:00
bin CMake: Mark qt-cmake-standalone-test as an executable on Unix 2020-12-04 11:22:38 +01:00
cmake CMake: add Qt::Gui dependency by default for Android tests 2021-02-11 10:09:17 +02:00
coin Add QNX7.1 to CI 2021-01-19 15:17:55 +02:00
config.tests Remove the qmake project files 2021-01-07 15:32:28 +01:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Doc: Online CSS: Fix image captions overlapping images used in tables 2021-02-09 12:51:50 +01:00
examples Turn off the dbus examples for qmake-generated VS projects 2021-02-09 15:45:06 +01:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
mkspecs Bump copyright year to 2021 2021-01-25 20:00:44 +01:00
qmake Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
src macOS: Be honest about the system locale 2021-02-11 15:01:45 +01:00
tests macOS: Be honest about the system locale 2021-02-11 15:01:45 +01:00
util Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
.cmake.conf Lower the CMake minimum required version for single-config builds 2021-01-14 17:00:55 +01:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore .gitignore: Qt Creator files cleanup 2020-09-25 07:50:15 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.prev_configure.cmake Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
.prev_qt_cmdline.cmake CMake: Regenerate configure.cmake files 2020-09-28 15:48:17 +02:00
.qmake.conf Bump version 2020-12-15 15:54:46 +01:00
.tag
CMakeLists.txt CMake: Bail out if the build dir is symlinked 2020-12-21 13:22:26 +01:00
config_help.txt Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
configure Remove qmake-related code from configure 2020-12-21 10:33:33 +01:00
configure.bat Remove qmake-related code from configure 2020-12-21 10:33:33 +01:00
configure.cmake Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
configure.json Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
INSTALL INSTALL: Remove outdated reference to Windows CE 2019-02-13 13:01:57 +00:00
LICENSE.FDL
LICENSE.GPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPLv3 Remove LICENSE.GPLv3, LICENSE.LGPLv21, LGPL_EXCEPTION.txt 2018-04-16 11:02:14 +00:00
LICENSE.QT-LICENSE-AGREEMENT Update enterprise license agreement v4.2.1 2019-12-18 13:07:19 +02:00
qt_cmdline.cmake Update name of c++2a to c++20 2021-02-10 07:54:06 +01:00
sync.profile Generate QUtf8StringView header file from qutf8stringview.h 2020-11-07 08:35:11 +00:00