Skip to content

Commit

Permalink
Fix empty value returned by getlocale (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
liang2kl committed Jul 21, 2023
1 parent d5cefd1 commit ad4f4bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mkdocs_blogging_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ def get_localized_date(timestamp: float, day_only: bool, format: str=None, _loca
_locale = locale.getdefaultlocale()[0]
else:
_locale = locale.getlocale()[0]
# Fallback to en_US if locale environment is not set
if not _locale:
_locale = "en_US"

if day_only:
return format_date(time.date(), format="short", locale=_locale)
Expand Down

0 comments on commit ad4f4bb

Please sign in to comment.