mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-130665: Only apply locale to calendar CLI via --locale
and not LANG
env var (#130676)
This commit is contained in:
parent
e21863ce78
commit
c1b4a6bd61
2 changed files with 10 additions and 2 deletions
|
@ -648,7 +648,7 @@ class LocaleHTMLCalendar(HTMLCalendar):
|
|||
return super().formatmonthname(theyear, themonth, withyear)
|
||||
|
||||
|
||||
class _CLIDemoCalendar(LocaleTextCalendar):
|
||||
class _CLIDemoCalendar(TextCalendar):
|
||||
def __init__(self, highlight_day=None, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.highlight_day = highlight_day
|
||||
|
@ -752,6 +752,12 @@ class _CLIDemoCalendar(LocaleTextCalendar):
|
|||
return ''.join(v)
|
||||
|
||||
|
||||
class _CLIDemoLocaleCalendar(LocaleTextCalendar, _CLIDemoCalendar):
|
||||
def __init__(self, highlight_day=None, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.highlight_day = highlight_day
|
||||
|
||||
|
||||
# Support for old module level interface
|
||||
c = TextCalendar()
|
||||
|
||||
|
@ -893,7 +899,7 @@ def main(args=None):
|
|||
write(cal.formatyearpage(options.year, **optdict))
|
||||
else:
|
||||
if options.locale:
|
||||
cal = _CLIDemoCalendar(highlight_day=today, locale=locale)
|
||||
cal = _CLIDemoLocaleCalendar(highlight_day=today, locale=locale)
|
||||
else:
|
||||
cal = _CLIDemoCalendar(highlight_day=today)
|
||||
cal.setfirstweekday(options.first_weekday)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue