mail: format_date plus sympath
This commit is contained in:
parent
5c057f83ae
commit
029235cfc4
1 changed files with 9 additions and 1 deletions
|
@ -6,6 +6,7 @@ import jinja2
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import inspect
|
import inspect
|
||||||
|
import locale
|
||||||
|
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
from email.message import Message
|
from email.message import Message
|
||||||
|
@ -28,7 +29,14 @@ text_mutilang_template = template_path + 'text_multilang'
|
||||||
|
|
||||||
templateLoader = jinja2.FileSystemLoader( searchpath=["/", template_path] )
|
templateLoader = jinja2.FileSystemLoader( searchpath=["/", template_path] )
|
||||||
templateEnv = jinja2.Environment( loader=templateLoader )
|
templateEnv = jinja2.Environment( loader=templateLoader )
|
||||||
templateEnv.filters['date'] = lambda d: d.strftime('%d %B %Y')
|
|
||||||
|
def format_date(d):
|
||||||
|
if 'fr_FR' in locale.getlocale():
|
||||||
|
return d.strftime('%A %d %B %Y')
|
||||||
|
else:
|
||||||
|
return d.strftime('%A, %B %d %Y')
|
||||||
|
|
||||||
|
templateEnv.filters['date'] = format_date
|
||||||
|
|
||||||
|
|
||||||
# file extension to rendering function map
|
# file extension to rendering function map
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue