Skip to content

Conversation

@No-22-Github
Copy link

Although Python 3.11 still supports locale.getdefaultlocale(), it is deprecated and will be removed in Python 3.15+. This change avoids the warning and improves forward compatibility.

@Akegarasu
Copy link
Owner

getlocale cant be simply replaced

>>> import locale
>>> locale.getlocale()
('Chinese (Simplified)_China', '936')
>>> locale.getdefaultlocale()
('zh_CN', 'cp936')

@No-22-Github
Copy link
Author

Thank you for pointing this out. I mistakenly assumed that getlocale() could be used as a direct replacement for getdefaultlocale(), without fully considering the behavioral and structural differences between the two.

I’ll carefully review the relevant code and revise the implementation accordingly. I’ll submit a new PR once I’ve addressed the issue properly. I still have much to learn—thank you for your patience and guidance.

@No-22-Github
Copy link
Author

I've updated the implementation of get_locale_compat() to better handle systems without locale-related environment variables, such as Windows. It now falls back to locale.getlocale() when necessary, which allows it to correctly detect Chinese locale on Windows systems as well.

Please kindly review the updated changes when you have time. Thank you again for your detailed feedback.

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.

2 participants