Code

Ticket #7980: 7980_v1.diff

File 7980_v1.diff, 23.2 KB (added by garcia_marc, 6 years ago)

Initial patch (partial)

Line 
1Index: conf/locale/ca/LC_MESSAGES/django.po
2===================================================================
3--- conf/locale/ca/LC_MESSAGES/django.po        (revision 8093)
4+++ conf/locale/ca/LC_MESSAGES/django.po        (working copy)
5@@ -501,10 +501,6 @@
6 msgid "Action"
7 msgstr "Acció"
8 
9-#: contrib/admin/templates/admin/object_history.html:25
10-msgid "DATE_WITH_TIME_FULL"
11-msgstr "F j, Y, H:i "
12-
13 #: contrib/admin/templates/admin/object_history.html:35
14 msgid ""
15 "This object doesn't have a change history. It probably wasn't added via this "
16@@ -4378,26 +4374,46 @@
17 msgid ", %(number)d %(type)s"
18 msgstr ", %(number)d %(type)s"
19 
20-#: utils/translation/trans_real.py:403
21-msgid "DATE_FORMAT"
22-msgstr "F j, Y"
23-
24 #: utils/translation/trans_real.py:404
25-msgid "DATETIME_FORMAT"
26-msgstr "F j, Y, H:i"
27+msgid "LONG_DATE_FORMAT"
28+msgstr "l, j \\de N \\de Y"
29 
30 #: utils/translation/trans_real.py:405
31+msgid "SHORT_DATE_FORMAT"
32+msgstr "d/m/Y"
33+
34+#: utils/translation/trans_real.py:406
35+msgid "LONG_DATETIME_FORMAT"
36+msgstr "l, j \\de N \\de Y, H:i"
37+
38+#: utils/translation/trans_real.py:407
39+msgid "SHORT_DATETIME_FORMAT"
40+msgstr "d/m/Y, H:i"
41+
42+#: utils/translation/trans_real.py:408
43 msgid "TIME_FORMAT"
44 msgstr "H:i"
45 
46-#: utils/translation/trans_real.py:421
47+#: utils/translation/trans_real.py:409
48 msgid "YEAR_MONTH_FORMAT"
49-msgstr "j de/d' F del Y"
50+msgstr "F \\de Y"
51 
52-#: utils/translation/trans_real.py:422
53+#: utils/translation/trans_real.py:410
54 msgid "MONTH_DAY_FORMAT"
55-msgstr "j de/d' F del Y"
56+msgstr "j \\de F"
57 
58+#: utils/translation/trans_real.py:411
59+msgid "FIRST_DAY_OF_WEEK"
60+msgstr "1"
61+
62+#: utils/translation/trans_real.py:412
63+msgid "DECIMAL_SEPARATOR"
64+msgstr ","
65+
66+#: utils/translation/trans_real.py:413
67+msgid "THOUSAND_SEPARATOR"
68+msgstr "."
69+
70 #: views/generic/create_update.py:43
71 #, python-format
72 msgid "The %(verbose_name)s was created successfully."
73Index: conf/locale/ca/LC_MESSAGES/djangojs.mo
74===================================================================
75Cannot display: file marked as a binary type.
76svn:mime-type = application/octet-stream
77Index: conf/locale/ca/LC_MESSAGES/django.mo
78===================================================================
79Cannot display: file marked as a binary type.
80svn:mime-type = application/octet-stream
81Index: conf/locale/ca/LC_MESSAGES/djangojs.po
82===================================================================
83--- conf/locale/ca/LC_MESSAGES/djangojs.po      (revision 8093)
84+++ conf/locale/ca/LC_MESSAGES/djangojs.po      (working copy)
85@@ -57,6 +57,10 @@
86 msgid "S M T W T F S"
87 msgstr "Dg Dl Dt Dc Dj Dv Ds"
88 
89+#: contrib/admin/media/js/calendar.js:26
90+msgid "FIRST_DAY_OF_WEEK"
91+msgstr "1"
92+
93 #: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
94 #: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
95 msgid "Now"
96Index: conf/locale/en/LC_MESSAGES/django.po
97===================================================================
98--- conf/locale/en/LC_MESSAGES/django.po        (revision 8093)
99+++ conf/locale/en/LC_MESSAGES/django.po        (working copy)
100@@ -474,10 +474,6 @@
101 msgid "Action"
102 msgstr ""
103 
104-#: contrib/admin/templates/admin/object_history.html:25
105-msgid "DATE_WITH_TIME_FULL"
106-msgstr "N j, Y, P"
107-
108 #: contrib/admin/templates/admin/object_history.html:35
109 msgid ""
110 "This object doesn't have a change history. It probably wasn't added via this "
111@@ -3732,26 +3728,46 @@
112 msgid ", %(number)d %(type)s"
113 msgstr ""
114 
115-#: utils/translation/trans_real.py:399
116-msgid "DATE_FORMAT"
117+#: utils/translation/trans_real.py:405
118+msgid "LONG_DATE_FORMAT"
119 msgstr "N j, Y"
120 
121-#: utils/translation/trans_real.py:400
122-msgid "DATETIME_FORMAT"
123+#: utils/translation/trans_real.py:406
124+msgid "SHORT_DATE_FORMAT"
125+msgstr "m/d/Y"
126+
127+#: utils/translation/trans_real.py:407
128+msgid "LONG_DATETIME_FORMAT"
129 msgstr "N j, Y, P"
130 
131-#: utils/translation/trans_real.py:401
132+#: utils/translation/trans_real.py:408
133+msgid "SHORT_DATETIME_FORMAT"
134+msgstr "m/d/Y, P"
135+
136+#: utils/translation/trans_real.py:409
137 msgid "TIME_FORMAT"
138 msgstr "P"
139 
140-#: utils/translation/trans_real.py:417
141+#: utils/translation/trans_real.py:410
142 msgid "YEAR_MONTH_FORMAT"
143 msgstr "F Y"
144 
145-#: utils/translation/trans_real.py:418
146+#: utils/translation/trans_real.py:411
147 msgid "MONTH_DAY_FORMAT"
148 msgstr "F j"
149 
150+#: utils/translation/trans_real.py:412
151+msgid "FIRST_DAY_OF_WEEK"
152+msgstr "0"
153+
154+#: utils/translation/trans_real.py:413
155+msgid "DECIMAL_SEPARATOR"
156+msgstr ","
157+
158+#: utils/translation/trans_real.py:414
159+msgid "THOUSAND_SEPARATOR"
160+msgstr "."
161+
162 #: views/generic/create_update.py:43
163 #, python-format
164 msgid "The %(verbose_name)s was created successfully."
165Index: conf/locale/en/LC_MESSAGES/djangojs.mo
166===================================================================
167Cannot display: file marked as a binary type.
168svn:mime-type = application/octet-stream
169Index: conf/locale/en/LC_MESSAGES/django.mo
170===================================================================
171Cannot display: file marked as a binary type.
172svn:mime-type = application/octet-stream
173Index: conf/locale/en/LC_MESSAGES/djangojs.po
174===================================================================
175--- conf/locale/en/LC_MESSAGES/djangojs.po      (revision 8093)
176+++ conf/locale/en/LC_MESSAGES/djangojs.po      (working copy)
177@@ -56,6 +56,10 @@
178 msgid "S M T W T F S"
179 msgstr ""
180 
181+#: contrib/admin/media/js/calendar.js:26
182+msgid "FIRST_DAY_OF_WEEK"
183+msgstr "0"
184+
185 #: contrib/admin/media/js/dateparse.js:33
186 msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
187 msgstr ""
188Index: conf/global_settings.py
189===================================================================
190--- conf/global_settings.py     (revision 8093)
191+++ conf/global_settings.py     (working copy)
192@@ -249,14 +249,22 @@
193 # (i.e. "/tmp" on *nix systems).
194 FILE_UPLOAD_TEMP_DIR = None
195 
196-# Default formatting for date objects. See all available format strings here:
197+# Default formatting for long date objects. See all available format strings here:
198 # http://www.djangoproject.com/documentation/templates/#now
199-DATE_FORMAT = 'N j, Y'
200+LONG_DATE_FORMAT = 'N j, Y'
201 
202-# Default formatting for datetime objects. See all available format strings here:
203+# Default formatting for short date objects. See all available format strings here:
204 # http://www.djangoproject.com/documentation/templates/#now
205-DATETIME_FORMAT = 'N j, Y, P'
206+SHORT_DATE_FORMAT = 'm/d/Y'
207 
208+# Default formatting for long datetime objects. See all available format strings here:
209+# http://www.djangoproject.com/documentation/templates/#now
210+LONG_DATETIME_FORMAT = 'N j, Y, P'
211+
212+# Default formatting for short datetime objects. See all available format strings here:
213+# http://www.djangoproject.com/documentation/templates/#now
214+SHORT_DATETIME_FORMAT = 'm/d/Y P'
215+
216 # Default formatting for time objects. See all available format strings here:
217 # http://www.djangoproject.com/documentation/templates/#now
218 TIME_FORMAT = 'P'
219@@ -271,6 +279,15 @@
220 # http://www.djangoproject.com/documentation/templates/#now
221 MONTH_DAY_FORMAT = 'F j'
222 
223+# Default value for first day of week on calendars. 0 is Sunday, 1 is Monday...
224+FIRST_DAY_OF_WEEK = '0'
225+
226+# Default value used as decimal separator when formatting numbers.
227+DECIMAL_SEPARATOR = '.'
228+
229+# Default value used as thousand separator when formatting numbers.
230+THOUSAND_SEPARATOR = ','
231+
232 # Do you want to manage transactions manually?
233 # Hint: you really don't!
234 TRANSACTIONS_MANAGED = False
235Index: utils/translation/trans_real.py
236===================================================================
237--- utils/translation/trans_real.py     (revision 8093)
238+++ utils/translation/trans_real.py     (working copy)
239@@ -4,9 +4,12 @@
240 import os
241 import re
242 import sys
243+import decimal
244+import datetime
245 import gettext as gettext_module
246 from cStringIO import StringIO
247 
248+from django.utils import dateformat
249 from django.utils.safestring import mark_safe, SafeData
250 from django.utils.thread_support import currentThread
251 
252@@ -391,38 +394,45 @@
253 
254     return settings.LANGUAGE_CODE
255 
256-def get_date_formats():
257+def get_formats():
258     """
259     Checks whether translation files provide a translation for some technical
260-    message ID to store date and time formats. If it doesn't contain one, the
261+    message ID to store date, time and number formats. If it doesn't contain one, the
262     formats provided in the settings will be used.
263     """
264     from django.conf import settings
265-    date_format = ugettext('DATE_FORMAT')
266-    datetime_format = ugettext('DATETIME_FORMAT')
267-    time_format = ugettext('TIME_FORMAT')
268-    if date_format == 'DATE_FORMAT':
269-        date_format = settings.DATE_FORMAT
270-    if datetime_format == 'DATETIME_FORMAT':
271-        datetime_format = settings.DATETIME_FORMAT
272-    if time_format == 'TIME_FORMAT':
273-        time_format = settings.TIME_FORMAT
274-    return date_format, datetime_format, time_format
275+    formats = {}
276+    formats['LONG_DATE_FORMAT'] = ugettext('LONG_DATE_FORMAT')
277+    formats['SHORT_DATE_FORMAT'] = ugettext('SHORT_DATE_FORMAT')
278+    formats['LONG_DATETIME_FORMAT'] = ugettext('LONG_DATETIME_FORMAT')
279+    formats['SHORT_DATETIME_FORMAT'] = ugettext('SHORT_DATETIME_FORMAT')
280+    formats['TIME_FORMAT'] = ugettext('TIME_FORMAT')
281+    formats['YEAR_MONTH_FORMAT'] = ugettext('YEAR_MONTH_FORMAT')
282+    formats['MONTH_DAY_FORMAT'] = ugettext('MONTH_DAY_FORMAT')
283+    formats['FIRST_DAY_OF_WEEK'] = ugettext('FIRST_DAY_OF_WEEK')
284+    formats['DECIMAL_SEPARATOR'] = ugettext('DECIMAL_SEPARATOR')
285+    formats['THOUSAND_SEPARATOR'] = ugettext('THOUSAND_SEPARATOR')
286+   
287+    for format_name, format_value in formats.iteritems():
288+        if format_name == format_value:
289+            formats[format_name] = getattr(settings, format_name)
290 
291-def get_partial_date_formats():
292+    return formats
293+
294+def i18ize(value):
295     """
296-    Checks whether translation files provide a translation for some technical
297-    message ID to store partial date formats. If it doesn't contain one, the
298-    formats provided in the settings will be used.
299+    Converts a date/time or decimal number to a string, using the format defined
300+    for current locale.
301     """
302-    from django.conf import settings
303-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
304-    month_day_format = ugettext('MONTH_DAY_FORMAT')
305-    if year_month_format == 'YEAR_MONTH_FORMAT':
306-        year_month_format = settings.YEAR_MONTH_FORMAT
307-    if month_day_format == 'MONTH_DAY_FORMAT':
308-        month_day_format = settings.MONTH_DAY_FORMAT
309-    return year_month_format, month_day_format
310+    formats = get_formats()
311+    if isinstance(value, decimal.Decimal):
312+        return str(value).replace('.', formats['DECIMAL_SEPARATOR'])
313+    elif isinstance(value, datetime.date):
314+        return dateformat.format(value, formats['LONG_DATE_FORMAT'])
315+    elif isinstance(value, datetime.datetime):
316+        return dateformat.format(value, formats['LONG_DATETIME_FORMAT'])
317+    else:
318+        return value
319 
320 dot_re = re.compile(r'\S')
321 def blankout(src, char):
322Index: utils/translation/__init__.py
323===================================================================
324--- utils/translation/__init__.py       (revision 8093)
325+++ utils/translation/__init__.py       (working copy)
326@@ -6,10 +6,9 @@
327 
328 __all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
329         'ngettext_lazy', 'string_concat', 'activate', 'deactivate',
330-        'get_language', 'get_language_bidi', 'get_date_formats',
331-        'get_partial_date_formats', 'check_for_language', 'to_locale',
332-        'get_language_from_request', 'templatize', 'ugettext',
333-        'ungettext', 'deactivate_all']
334+        'get_language', 'get_language_bidi', 'get_formats', 'i18ize',
335+        'check_for_language', 'to_locale', 'get_language_from_request',
336+        'templatize', 'ugettext', 'ungettext', 'deactivate_all']
337 
338 # Here be dragons, so a short explanation of the logic won't hurt:
339 # We are trying to solve two problems: (1) access settings, in particular
340@@ -81,11 +80,11 @@
341 def get_language_bidi():
342     return real_get_language_bidi()
343 
344-def get_date_formats():
345-    return real_get_date_formats()
346+def get_formats():
347+    return real_get_formats()
348 
349-def get_partial_date_formats():
350-    return real_get_partial_date_formats()
351+def i18ize(value):
352+    return real_i18ize(value)
353 
354 def check_for_language(lang_code):
355     return real_check_for_language(lang_code)
356Index: utils/translation/trans_null.py
357===================================================================
358--- utils/translation/trans_null.py     (revision 8093)
359+++ utils/translation/trans_null.py     (working copy)
360@@ -18,8 +18,6 @@
361 deactivate = deactivate_all = lambda: None
362 get_language = lambda: settings.LANGUAGE_CODE
363 get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
364-get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
365-get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
366 check_for_language = lambda x: True
367 
368 TECHNICAL_ID_MAP = {
369@@ -51,3 +49,15 @@
370 
371 def get_language_from_request(request):
372     return settings.LANGUAGE_CODE
373+
374+def get_formats():
375+    formats = ('LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT', 'LONG_DATETIME_FORMAT',
376+        'SHORT_DATETIME_FORMAT', 'TIME_FORMAT', 'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT',
377+        'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR', 'THOUSAND_SEPARATOR')
378+    result = {}
379+    for format in formats:
380+        result[format] = getattr(settings, format)
381+    return result
382+
383+def i18ize(value):
384+    return value
385Index: contrib/admin/media/js/calendar.js
386===================================================================
387--- contrib/admin/media/js/calendar.js  (revision 8093)
388+++ contrib/admin/media/js/calendar.js  (working copy)
389@@ -25,6 +25,7 @@
390 var CalendarNamespace = {
391     monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
392     daysOfWeek: gettext('S M T W T F S').split(' '),
393+    firstDayOfWeek: parseInt(gettext('FIRST_DAY_OF_WEEK').replace('FIRST_DAY_OF_WEEK', '0')),
394     isLeapYear: function(year) {
395         return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
396     },
397@@ -56,7 +57,7 @@
398         // Draw days-of-week header
399         var tableRow = quickElement('tr', tableBody);
400         for (var i = 0; i < 7; i++) {
401-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]);
402+            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
403         }
404 
405         var startingPos = new Date(year, month-1, 1).getDay();
406Index: contrib/admin/templatetags/admin_list.py
407===================================================================
408--- contrib/admin/templatetags/admin_list.py    (revision 8093)
409+++ contrib/admin/templatetags/admin_list.py    (working copy)
410@@ -7,7 +7,7 @@
411 from django.utils.html import escape, conditional_escape
412 from django.utils.text import capfirst
413 from django.utils.safestring import mark_safe
414-from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
415+from django.utils.translation import get_formats, ugettext as _
416 from django.utils.encoding import smart_unicode, smart_str, force_unicode
417 from django.template import Library
418 import datetime
419@@ -153,6 +153,7 @@
420         else:
421             field_val = getattr(result, f.attname)
422 
423+            formats = get_formats()
424             if isinstance(f.rel, models.ManyToOneRel):
425                 if field_val is not None:
426                     result_repr = escape(getattr(result, f.name))
427@@ -161,13 +162,12 @@
428             # Dates and times are special: They're formatted in a certain way.
429             elif isinstance(f, models.DateField) or isinstance(f, models.TimeField):
430                 if field_val:
431-                    (date_format, datetime_format, time_format) = get_date_formats()
432                     if isinstance(f, models.DateTimeField):
433-                        result_repr = capfirst(dateformat.format(field_val, datetime_format))
434+                        result_repr = capfirst(dateformat.format(field_val, formats['LONG_DATETIME_FORMAT']))
435                     elif isinstance(f, models.TimeField):
436-                        result_repr = capfirst(dateformat.time_format(field_val, time_format))
437+                        result_repr = capfirst(dateformat.time_format(field_val, formats['TIME_FORMAT']))
438                     else:
439-                        result_repr = capfirst(dateformat.format(field_val, date_format))
440+                        result_repr = capfirst(dateformat.format(field_val, formats['LONG_DATE_FORMAT']))
441                 else:
442                     result_repr = EMPTY_CHANGELIST_VALUE
443                 row_class = ' class="nowrap"'
444@@ -177,7 +177,7 @@
445             # DecimalFields are special: Zero-pad the decimals.
446             elif isinstance(f, models.DecimalField):
447                 if field_val is not None:
448-                    result_repr = ('%%.%sf' % f.decimal_places) % field_val
449+                    result_repr = (('%%.%sf' % f.decimal_places) % field_val).replace('.', formats['DECIMAL_SEPARATOR'])
450                 else:
451                     result_repr = EMPTY_CHANGELIST_VALUE
452             # Fields with choices are special: Use the representation
453@@ -221,7 +221,7 @@
454         year_lookup = cl.params.get(year_field)
455         month_lookup = cl.params.get(month_field)
456         day_lookup = cl.params.get(day_field)
457-        year_month_format, month_day_format = get_partial_date_formats()
458+        formats = get_formats()
459 
460         link = lambda d: mark_safe(cl.get_query_string(d, [field_generic]))
461 
462@@ -231,9 +231,9 @@
463                 'show': True,
464                 'back': {
465                     'link': link({year_field: year_lookup, month_field: month_lookup}),
466-                    'title': dateformat.format(day, year_month_format)
467+                    'title': dateformat.format(day, formats['YEAR_MONTH_FORMAT'])
468                 },
469-                'choices': [{'title': dateformat.format(day, month_day_format)}]
470+                'choices': [{'title': dateformat.format(day, formats['MONTH_DAY_FORMAT'])}]
471             }
472         elif year_lookup and month_lookup:
473             days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')
474@@ -245,7 +245,7 @@
475                 },
476                 'choices': [{
477                     'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),
478-                    'title': dateformat.format(day, month_day_format)
479+                    'title': dateformat.format(day, formats['MONTH_DAY_FORMAT'])
480                 } for day in days]
481             }
482         elif year_lookup:
483@@ -258,7 +258,7 @@
484                 },
485                 'choices': [{
486                     'link': link({year_field: year_lookup, month_field: month.month}),
487-                    'title': dateformat.format(month, year_month_format)
488+                    'title': dateformat.format(month, formats['YEAR_MONTH_FORMAT'])
489                 } for month in months]
490             }
491         else:
492Index: contrib/admin/templates/admin/object_history.html
493===================================================================
494--- contrib/admin/templates/admin/object_history.html   (revision 8093)
495+++ contrib/admin/templates/admin/object_history.html   (working copy)
496@@ -21,7 +21,7 @@
497         <tbody>
498         {% for action in action_list %}
499         <tr>
500-            <th scope="row">{{ action.action_time|date:_("DATE_WITH_TIME_FULL") }}</th>
501+            <th scope="row">{{ action.action_time }}</th>
502             <td>{{ action.user.username }}{% if action.user.first_name %} ({{ action.user.first_name }} {{ action.user.last_name }}){% endif %}</td>
503             <td>{{ action.change_message }}</td>
504         </tr>
505Index: contrib/databrowse/datastructures.py
506===================================================================
507--- contrib/databrowse/datastructures.py        (revision 8093)
508+++ contrib/databrowse/datastructures.py        (working copy)
509@@ -6,7 +6,7 @@
510 from django.db import models
511 from django.utils import dateformat
512 from django.utils.text import capfirst
513-from django.utils.translation import get_date_formats
514+from django.utils.translation import get_formats
515 from django.utils.encoding import smart_unicode, smart_str, iri_to_uri
516 from django.utils.safestring import mark_safe
517 from django.db.models.query import QuerySet
518@@ -156,13 +156,13 @@
519             objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
520         elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
521             if self.raw_value:
522-                date_format, datetime_format, time_format = get_date_formats()
523+                formats = get_formats()
524                 if isinstance(self.field, models.DateTimeField):
525-                    objs = capfirst(dateformat.format(self.raw_value, datetime_format))
526+                    objs = capfirst(dateformat.format(self.raw_value, formats['DATETIME_FORMAT']))
527                 elif isinstance(self.field, models.TimeField):
528-                    objs = capfirst(dateformat.time_format(self.raw_value, time_format))
529+                    objs = capfirst(dateformat.time_format(self.raw_value, formats['TIME_FORMAT']))
530                 else:
531-                    objs = capfirst(dateformat.format(self.raw_value, date_format))
532+                    objs = capfirst(dateformat.format(self.raw_value, formats['DATE_FORMAT']))
533             else:
534                 objs = EMPTY_VALUE
535         elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
536Index: template/__init__.py
537===================================================================
538--- template/__init__.py        (revision 8093)
539+++ template/__init__.py        (working copy)
540@@ -56,7 +56,7 @@
541 from django.utils.functional import curry, Promise
542 from django.utils.text import smart_split
543 from django.utils.encoding import smart_unicode, force_unicode
544-from django.utils.translation import ugettext as _
545+from django.utils.translation import i18ize, ugettext as _
546 from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping
547 from django.utils.html import escape
548 
549@@ -782,7 +782,9 @@
550 
551     def render(self, context):
552         try:
553-            output = force_unicode(self.filter_expression.resolve(context))
554+            value = self.filter_expression.resolve(context)
555+            i18n_value = i18ize(value)
556+            output = force_unicode(i18n_value)
557         except UnicodeDecodeError:
558             # Unicode conversion can fail sometimes for reasons out of our
559             # control (e.g. exception rendering). In that case, we fail quietly.
560Index: template/debug.py
561===================================================================
562--- template/debug.py   (revision 8093)
563+++ template/debug.py   (working copy)
564@@ -1,3 +1,4 @@
565+import decimal, datetime
566 from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
567 from django.utils.encoding import force_unicode
568 from django.utils.html import escape
569@@ -2,2 +3,3 @@
570 from django.utils.safestring import SafeData, EscapeData
571+from django.utils.translation import i18ize
572 
573@@ -84,7 +86,9 @@
574 class DebugVariableNode(VariableNode):
575     def render(self, context):
576         try:
577-            output = force_unicode(self.filter_expression.resolve(context))
578+            value = self.filter_expression.resolve(context)
579+            i18n_value = i18ize(value)
580+            output = force_unicode(i18n_value)
581         except TemplateSyntaxError, e:
582             if not hasattr(e, 'source'):
583                 e.source = self.source