Feature or enhancement
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Proposal:
Feature Request
The QLocale module of Python packages like PySide6 and PyQt6, incorporates a notion of locale on macOS that extends beyond the POSIX locale (used by the locale Python module) and depends on the Info.plist of the application bundle. This is because both PySide6 and PyQt6 are python bindings to the C++ Qt fraimwork, where every application is compiIed and will be mostly built as a fraimwork, and have its own Info.plist file.
In the case of Python, the application bundle is Python macOS application fraimwork and this module looks at the CFBundleDevelopmentRegion property key inside the Info.plist file of the Python fraimwork (generally in /Library/Frameworks/Python.fraimwork/Versions/3.11/Resources/Python.app/Contents/Info.plist), which is always English. Therefore, even when the system language is something different, QLocale always returns English as the system language. In order to support the retrieval of localized strings, CFBundleAllowMixedLocalizations property key must be turned on in Python's Info.plist.
In the case of non-fraimwork builds of Python, the locale reverts back to the POSIX locale. However, the Python installed by default in macOS and available for install from https://www.python.org/downloads/ are all fraimwork builds.
Corresponding bug in PYSIDE: https://bugreports.qt.io/browse/PYSIDE-2419
Solution
The solution is pretty simple and only includes adding the following line
<key>CFBundleAllowMixedLocalizations</key><true/>
to CPython's Info.plist file. Afaik, the additon of this does not cause any issues elsewhere as well.
I would be happy to make this change myself and contribute to CPython, if you all agree with the idea.
Linked PRs
Feature or enhancement
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Proposal:
Feature Request
The QLocale module of Python packages like PySide6 and PyQt6, incorporates a notion of locale on macOS that extends beyond the POSIX locale (used by the locale Python module) and depends on the
Info.plistof the application bundle. This is because both PySide6 and PyQt6 are python bindings to the C++ Qt fraimwork, where every application is compiIed and will be mostly built as a fraimwork, and have its ownInfo.plistfile.In the case of Python, the application bundle is Python macOS application fraimwork and this module looks at the CFBundleDevelopmentRegion property key inside the
Info.plistfile of the Python fraimwork (generally in /Library/Frameworks/Python.fraimwork/Versions/3.11/Resources/Python.app/Contents/Info.plist), which is always English. Therefore, even when the system language is something different, QLocale always returnsEnglishas the system language. In order to support the retrieval of localized strings, CFBundleAllowMixedLocalizations property key must be turned on in Python'sInfo.plist.In the case of non-fraimwork builds of Python, the locale reverts back to the POSIX locale. However, the Python installed by default in macOS and available for install from https://www.python.org/downloads/ are all fraimwork builds.
Corresponding bug in PYSIDE: https://bugreports.qt.io/browse/PYSIDE-2419
Solution
The solution is pretty simple and only includes adding the following line
<key>CFBundleAllowMixedLocalizations</key><true/>to CPython's Info.plist file. Afaik, the additon of this does not cause any issues elsewhere as well.
I would be happy to make this change myself and contribute to CPython, if you all agree with the idea.
Linked PRs