bpo-46659: calendar uses locale.getlocale()#31166
Conversation
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar classes module now use locale.getlocale(), instead of using locale.getdefaultlocale(), if no locale is specified.
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Would not be more correct to use |
Sorry, something went wrong.
|
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)? |
Sorry, something went wrong.
You're right: done. |
Sorry, something went wrong.
|
Merged, thanks for your reviews.
In case of doubt, I prefer to leave the code as it is. |
Sorry, something went wrong.
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