Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendarclasses module now use locale.getlocale(), instead of usinglocale.getdefaultlocale(), if no locale is specified.
vstinner commentedFeb 6, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Example with cal_locale.py attached tobpo-46659. Run the program in English, but switch to a french locale before creating the LocaleTextCalendar() instance. Current behavior: calendar speaks English, even if thecurrent 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. |
Uh oh!
There was an error while loading.Please reload this page.
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