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
@ -648,7 +648,7 @@ class LocaleHTMLCalendar(HTMLCalendar):
|
|||||||
return super().formatmonthname(theyear, themonth, withyear)
|
return super().formatmonthname(theyear, themonth, withyear)
|
||||||
|
|
||||||
|
|
||||||
class _CLIDemoCalendar(LocaleTextCalendar):
|
class _CLIDemoCalendar(TextCalendar):
|
||||||
def __init__(self, highlight_day=None, *args, **kwargs):
|
def __init__(self, highlight_day=None, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.highlight_day = highlight_day
|
self.highlight_day = highlight_day
|
||||||
@ -752,6 +752,12 @@ class _CLIDemoCalendar(LocaleTextCalendar):
|
|||||||
return ''.join(v)
|
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
|
# Support for old module level interface
|
||||||
c = TextCalendar()
|
c = TextCalendar()
|
||||||
|
|
||||||
@ -893,7 +899,7 @@ def main(args=None):
|
|||||||
write(cal.formatyearpage(options.year, **optdict))
|
write(cal.formatyearpage(options.year, **optdict))
|
||||||
else:
|
else:
|
||||||
if options.locale:
|
if options.locale:
|
||||||
cal = _CLIDemoCalendar(highlight_day=today, locale=locale)
|
cal = _CLIDemoLocaleCalendar(highlight_day=today, locale=locale)
|
||||||
else:
|
else:
|
||||||
cal = _CLIDemoCalendar(highlight_day=today)
|
cal = _CLIDemoCalendar(highlight_day=today)
|
||||||
cal.setfirstweekday(options.first_weekday)
|
cal.setfirstweekday(options.first_weekday)
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
Only apply locale to :ref:`calendar CLI <calendar-cli>` when set via
|
||||||
|
``--locale`` and not via ``LANG`` environment variable.
|
Loading…
x
Reference in New Issue
Block a user