MCPcopy Index your code
hub / github.com/RustPython/RustPython / LocaleHTMLCalendar

Class LocaleHTMLCalendar

Lib/calendar.py:631–648  ·  view source on GitHub ↗

This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale.

Source from the content-addressed store, hash-verified

629
630
631class LocaleHTMLCalendar(HTMLCalendar):
632 """
633 This class can be passed a locale name in the constructor and will return
634 month and weekday names in the specified locale.
635 """
636 def __init__(self, firstweekday=0, locale=None):
637 HTMLCalendar.__init__(self, firstweekday)
638 if locale is None:
639 locale = _get_default_locale()
640 self.locale = locale
641
642 def formatweekday(self, day):
643 with different_locale(self.locale):
644 return super().formatweekday(day)
645
646 def formatmonthname(self, theyear, themonth, withyear=True):
647 with different_locale(self.locale):
648 return super().formatmonthname(theyear, themonth, withyear)
649
650
651class _CLIDemoCalendar(TextCalendar):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected