localization of email headers, added the datetime format settings in …#934
localization of email headers, added the datetime format settings in …#934tonioo merged 2 commits intomodoboa:masterfrom christianwgd:master
Conversation
…test_project settings.py with some docs
Current coverage is 77.27% (diff: 50.00%)@@ master #934 diff @@
==========================================
Files 131 131
Lines 7005 7009 +4
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 5414 5416 +2
- Misses 1591 1593 +2
Partials 0 0
|
|
|
||
| # emails of the last week | ||
| # en-us style | ||
| WEBMAIL_SHORT_DATETIME_FORMAT = "l, P" |
There was a problem hiding this comment.
I know part of the code used by the webmail might not be at the right place but the settings related to the webmail should be move the webmail repository. You can take example on the amavis plugin: https://github.com/modoboa/modoboa-amavis/blob/master/modoboa_amavis/settings.py.
| # en-us style | ||
| WEBMAIL_DATETIME_FORMAT = "N, j Y P" | ||
| # european style | ||
| # WEBMAIL_DATETIME_FORMAT = "d. N Y H:i" |
| names = {'From': _('From'), 'To': _('To'), 'Date': _('Date'), 'Subject': _('Subject')} | ||
| if names.has_key(headername): | ||
| return names[headername] | ||
| return headername |
There was a problem hiding this comment.
You can simplify those 3 lines into 1 like this:
return names.get(headername, headername)| @register.filter(name='localize_header_name') | ||
| def localize_header_name(headername): | ||
| """ Localizes the header names """ | ||
| names = {'From': _('From'), 'To': _('To'), 'Date': _('Date'), 'Subject': _('Subject')} |
There was a problem hiding this comment.
Could you please use " instead of ' for strings. I'm currently updating the code to be consistent but it's a long path...
|
I put the settings into modoboa because i didn’t find one in modoboa-webmail. Thanks to your hint, i will create one. No problem with the string delimiters, i will change them.
|
…ime formatting settings to new settings.py in webmail module.
…test_project settings.py with some docs
Localization of the email header fields by adding a template filter to lib_tags.py that translates the header labels "From", "To", "Date" and "Subject" and is used in the mailheaders template. Added the required translation strings to the locale po files.