changeset 2907:8ca12f30f61f

template (filters): set locale when using "date_fmt"
author Goffi <goffi@goffi.org>
date Sun, 14 Apr 2019 08:21:51 +0200
parents 7dbdbd132649
children 695fc440c3b8
files sat/tools/common/template.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sat/tools/common/template.py	Sun Apr 14 08:21:51 2019 +0200
+++ b/sat/tools/common/template.py	Sun Apr 14 08:21:51 2019 +0200
@@ -646,15 +646,14 @@
         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))