-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-46659: calendar uses locale.getlocale() #31166
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
Conversation
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar classes module now use locale.getlocale(), instead of using locale.getdefaultlocale(), if no locale is specified.
Example with cal_locale.py attached to bpo-46659. Run the program in English, but switch to a french locale before creating the LocaleTextCalendar() instance. Current behavior: calendar speaks English, even if the current LC_TIME locale is French:
With this PR: calendar speaks French:
Applications which don't call setlocale() to change the LC_ALL or LC_TIME locale are not affected. |
Would not be more correct to use |
With this PR, the two classes store the current locale when an instance is created. Is it really an important feature? Or would it be acceptable to use the current locale (don't change the locale) if locale=None is passed (default behavior)? |
You're right: done. |
Merged, thanks for your reviews.
In case of doubt, I prefer to leave the code as it is. |
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar
classes module now use locale.getlocale(), instead of using
locale.getdefaultlocale(), if no locale is specified.
https://bugs.python.org/issue46659