MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / LocaleTextCalendar

Class LocaleTextCalendar

tools/python-3.11.9-amd64/Lib/calendar.py:573–591  ·  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

571
572
573class LocaleTextCalendar(TextCalendar):
574 """
575 This class can be passed a locale name in the constructor and will return
576 month and weekday names in the specified locale.
577 """
578
579 def __init__(self, firstweekday=0, locale=None):
580 TextCalendar.__init__(self, firstweekday)
581 if locale is None:
582 locale = _get_default_locale()
583 self.locale = locale
584
585 def formatweekday(self, day, width):
586 with different_locale(self.locale):
587 return super().formatweekday(day, width)
588
589 def formatmonthname(self, theyear, themonth, width, withyear=True):
590 with different_locale(self.locale):
591 return super().formatmonthname(theyear, themonth, width, withyear)
592
593
594class LocaleHTMLCalendar(HTMLCalendar):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected