Skip to content

PR: Remove depreciated locale.getdefaultlocale #24875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

athompson673
Copy link
Contributor

On windows use win32 GetUserDefaultLocaleName instead of locale.getlocale due to non-BCP47 locale code.

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

locale.getdefaultlocale is depreciated and is slated for removal in python 3.15. locale.getlocale as the suggested alternative does not return BCP47 locale codes ("English_United States" rather than "en-US"). Instead call the win32GetUserDefaultLocaleName function via the ctypes builtin library in order to not add any dependencies.

Issue(s) Resolved

Fixes #23318

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: athompson673

On windows use win32 GetUserDefaultLocaleName instead of locale.getlocale due to non-BCP47 locale code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

locale.getdefaultlocale is depreciated and will be removed in 3.15
1 participant