Skip to content

Commit a12a7fb

Browse files
author
Vincent Vinet
committed
more choices for getting a language out of the qweb context
1 parent 3a28f87 commit a12a7fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

qweb_usertime/qweb.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ def render_tag_usertime(self, element, template_attributes,
3939
generated_attributes, qwebcontext):
4040
tformat = template_attributes['usertime']
4141
if not tformat:
42-
# No format, use default time and date formats from user lang
43-
lang = qwebcontext['user'].lang
42+
# No format, use default time and date formats from qwebcontext
43+
lang = (
44+
qwebcontext['env'].lang or
45+
qwebcontext['env'].context['lang'] or
46+
qwebcontext['user'].lang
47+
)
4448
if lang:
4549
lang = qwebcontext['env']['res.lang'].search(
4650
[('code', '=', lang)]

0 commit comments

Comments
 (0)