Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PySide: Fix QLocale::system() in macOS
- QSystemLocale for macOS relies on CFBundleAllowMixedLocalizations/ CFBundleLocalizations in the Info.plist file for the C++ Application bundle, as seen from 1d3ae5f0e98f252214d20ce8561533891311a71f. Python being an interpreted language, there is no application bundle unless the application is deployed. As such a Python application in macOS relies on the Info.plist file of the Python interepreter. This Info.plist file is a read-only file and hence it is not possible/recommended to patch the Info.plist file of the Python interpreter at runtime. The issue has been raised upstream in CPython and can be tracked here: python/cpython#108269 - A possible solution/hack is therefore to use to POSIX environment variables for macOS, for Qt for Python. This is also what the Python locale module does. See: https://github.com/python/cpython/blob/3.11/Lib/locale.py#L534 For other Unix systems, QLocale::system() uses the POSIX environment variables, just like Python's locale module. - For Windows and Linux, QSystem::locale() remains unchanged. - The idea here is to obtain the system locale from the Python locale module, and use the result to initialize and return a QLocale object. - As an extra, for qrunnable_create fix the typo - snipped to snippet. Fixes: PYSIDE-2419 Pick-to: 6.5 6.2 Change-Id: I12b16e824ddba21d1ebcd0695262c1dc0cc61eb2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- Loading branch information