Skip to content

Enable CFBundleAllowMixedLocalizations property list key inside Info.plist in macOS #108269

Closed
@shyamnathp

Description

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 framework, where every application is compiIed and will be mostly built as a framework, and have its own Info.plist file.

In the case of Python, the application bundle is Python macOS application framework and this module looks at the CFBundleDevelopmentRegion property key inside the Info.plist file of the Python framework (generally in /Library/Frameworks/Python.framework/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-framework 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 framework 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

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions