Code

Ticket #12309: django-12309.diff

File django-12309.diff, 1.8 KB (added by shell_dweller, 4 years ago)

Just the code patch, without .po files

Line 
1Index: django/utils/dates.py
2===================================================================
3--- django/utils/dates.py       (revision 11795)
4+++ django/utils/dates.py       (working copy)
5@@ -31,3 +31,8 @@
6     1:_('Jan.'), 2:_('Feb.'), 3:_('March'), 4:_('April'), 5:_('May'), 6:_('June'), 7:_('July'),
7     8:_('Aug.'), 9:_('Sept.'), 10:_('Oct.'), 11:_('Nov.'), 12:_('Dec.')
8 }
9+MONTHS_ALTERNATIVE = { # required by some locales
10+    1:_('_January'), 2:_('_February'), 3:_('_March'), 4:_('_April'), 5:_('_May'), 6:_('_June'),
11+    7:_('_July'), 8:_('_August'), 9:_('_September'), 10:_('_October'), 11:_('_November'),
12+    12:_('_December')
13+}
14\ No newline at end of file
15Index: django/utils/dateformat.py
16===================================================================
17--- django/utils/dateformat.py  (revision 11795)
18+++ django/utils/dateformat.py  (working copy)
19@@ -14,12 +14,12 @@
20 import re
21 import time
22 import calendar
23-from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
24+from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR, MONTHS_ALTERNATIVE
25 from django.utils.tzinfo import LocalTimezone
26 from django.utils.translation import ugettext as _
27 from django.utils.encoding import force_unicode
28 
29-re_formatchars = re.compile(r'(?<!\\)([aAbBdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
30+re_formatchars = re.compile(r'(?<!\\)([aAbBdDEfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
31 re_escaped = re.compile(r'\\(.)')
32 
33 class Formatter(object):
34@@ -126,6 +126,10 @@
35         "Day of the week, textual, 3 letters; e.g. 'Fri'"
36         return WEEKDAYS_ABBR[self.data.weekday()]
37 
38+    def E(self):
39+        "Alternative month names as required by some locales"
40+        return MONTHS_ALTERNATIVE[self.data.month]
41+
42     def F(self):
43         "Month, textual, long; e.g. 'January'"
44         return MONTHS[self.data.month]