Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Lib/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def formatmonthname(self, theyear, themonth, withyear=True):
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
Expand Down Expand Up @@ -752,6 +752,12 @@ def formatyear(self, theyear, w=2, l=1, c=6, m=3):
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()

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Only apply locale to :ref:`calendar CLI <calendar-cli>` when set via
``--locale`` and not via ``LANG`` environment variable.
Loading