INNER CODE UNIT · Python
day_label
GHJJ123/brainrotguard · i18n/__init__.py:87
def day_label(day: str, locale: str | None, short: bool = False) -> str:
"""Return localized day label from canonical day code."""
mapping = {
"mon": ("Monday", "Mon"),
"tue": ("Tuesday", "Tue"),
"wed": ("Wednesday", "Wed"),
"thu": ("Thursday", "Thu"),
"fri": ("Friday", "Fri"),
"sat": ("Saturday", "Sat"),
"sun": ("Sunday", "Sun"),
}
long_key, short_key = mapping.get(day, (day, day.capitalize()[:3]))
return t(locale, short_key if short else long_key)
def _uses_24h(locale: str | None, time_format: str | None) -> bool:
"""Decide whether to render times in 24-hour format."""
normalized_format = normalize_time_format(time_format)