diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-01 16:13:09 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-01 16:13:09 +0200 |
commit | 8010ff18bfe69dacc3e6fcdb93719dbf313d8849 (patch) | |
tree | b5da364648120a0a2f228af0f6a85c98994463b2 | |
parent | 4f8834e4096f97e43eea6166501caa0b03decef3 (diff) | |
download | fietsboek-8010ff18bfe69dacc3e6fcdb93719dbf313d8849.tar.gz fietsboek-8010ff18bfe69dacc3e6fcdb93719dbf313d8849.tar.bz2 fietsboek-8010ff18bfe69dacc3e6fcdb93719dbf313d8849.zip |
use month names from locale instead of redoing it
-rw-r--r-- | fietsboek/util.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/fietsboek/util.py b/fietsboek/util.py index b56584f..0f9cc5d 100644 --- a/fietsboek/util.py +++ b/fietsboek/util.py @@ -2,6 +2,7 @@ import random import string +import babel import markdown import bleach import gpxpy @@ -83,23 +84,8 @@ def month_name(request, month): :rtype: str """ assert 1 <= month <= 12 - # Explicitely list them so that Babel can extract them - months = [ - _("month.january"), - _("month.february"), - _("month.march"), - _("month.april"), - _("month.may"), - _("month.june"), - _("month.july"), - _("month.august"), - _("month.september"), - _("month.october"), - _("month.november"), - _("month.december"), - ] - our_month = months[month - 1] - return request.localizer.translate(our_month) + locale = babel.Locale.parse(request.localizer.locale_name) + return locale.months["stand-alone"]["wide"][month] def random_alphanum_string(length=20): |