template (filters): set locale when using "date_fmt"

This commit is contained in:
Goffi 2019-04-14 08:21:51 +02:00
commit bc061ee885

View file

@ -646,15 +646,14 @@ class Renderer(object):
current = ctx["gidx"].current(value)
return value if not current else u"{}_{}".format(value, current)
def _date_fmt(
self, timestamp, fmt="short", date_only=False, auto_limit=None, auto_old_fmt=None
):
def _date_fmt(self, timestamp, fmt="short", date_only=False, auto_limit=None,
auto_old_fmt=None):
if is_undefined(fmt):
fmt = u"short"
try:
return date_utils.date_fmt(
timestamp, fmt, date_only, auto_limit, auto_old_fmt
timestamp, fmt, date_only, auto_limit, auto_old_fmt,
locale_str = self._locale_str
)
except Exception as e:
log.warning(_(u"Can't parse date: {msg}").format(msg=e))