Code

Ticket #7980: i18n-formatting.4.diff

File i18n-formatting.4.diff, 146.3 KB (added by jezdez, 5 years ago)

Added Serbian and Serbian latin format strings from #11637

Line 
1diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
2index 828aef5..b2b6963 100644
3--- a/django/conf/global_settings.py
4+++ b/django/conf/global_settings.py
5@@ -103,6 +103,10 @@ USE_I18N = True
6 LOCALE_PATHS = ()
7 LANGUAGE_COOKIE_NAME = 'django_language'
8 
9+# If you set this to True, Django will format dates, numbers and calendars
10+# according to user current locale
11+USE_FORMAT_I18N = False
12+
13 # Not-necessarily-technical managers of the site. They get broken link
14 # notifications and other various e-mails.
15 MANAGERS = ADMINS
16@@ -262,6 +266,12 @@ FILE_UPLOAD_TEMP_DIR = None
17 # you'd pass directly to os.chmod; see http://docs.python.org/lib/os-file-dir.html.
18 FILE_UPLOAD_PERMISSIONS = None
19 
20+# Python module path where user will place custom format definition.
21+# The directory where this setting is pointing should contain subdirectories
22+# named as the locales, containing a formats.py file
23+# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use)
24+FORMAT_MODULE_PATH = None
25+
26 # Default formatting for date objects. See all available format strings here:
27 # http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
28 DATE_FORMAT = 'N j, Y'
29@@ -284,6 +294,72 @@ YEAR_MONTH_FORMAT = 'F Y'
30 # http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
31 MONTH_DAY_FORMAT = 'F j'
32 
33+# Default shortformatting for date objects. See all available format strings here:
34+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
35+SHORT_DATE_FORMAT = 'm/d/Y'
36+
37+# Default short formatting for datetime objects.
38+# See all available format strings here:
39+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
40+SHORT_DATETIME_FORMAT = 'm/d/Y P'
41+
42+# Default formats tried to parse dates from input boxes
43+# These formats are tried in the specified order
44+# See all available format string here:
45+# http://docs.python.org/library/datetime.html#strftime-behavior
46+# * Note that these format strings are different from the ones to display dates
47+DATE_INPUT_FORMATS = (
48+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
49+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
50+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
51+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
52+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
53+)
54+
55+# Default formats tried to parse times from input boxes
56+# These formats are tried in the specified order
57+# See all available format string here:
58+# http://docs.python.org/library/datetime.html#strftime-behavior
59+# * Note that these format strings are different from the ones to display dates
60+TIME_INPUT_FORMATS = (
61+    '%H:%M:%S',     # '14:30:59'
62+    '%H:%M',        # '14:30'
63+)
64+
65+# Default formats tried to parse dates and times from input boxes
66+# These formats are tried in the specified order
67+# See all available format string here:
68+# http://docs.python.org/library/datetime.html#strftime-behavior
69+# * Note that these format strings are different from the ones to display dates
70+DATETIME_INPUT_FORMATS = (
71+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
72+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
73+    '%Y-%m-%d',              # '2006-10-25'
74+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
75+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
76+    '%m/%d/%Y',              # '10/25/2006'
77+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
78+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
79+    '%m/%d/%y',              # '10/25/06'
80+)
81+
82+# First day of week, to be used on calendars
83+# 0 means Sunday, 1 means Monday...
84+FIRST_DAY_OF_WEEK = 0
85+
86+# Decimal separator symbol
87+DECIMAL_SEPARATOR = '.'
88+
89+# Boolean that sets whether to add thousand separator when formatting numbers
90+USE_THOUSAND_SEPARATOR = False
91+
92+# Number of digits that will be togheter, when spliting them by THOUSAND_SEPARATOR
93+# 0 means no grouping, 3 means splitting by thousands...
94+NUMBER_GROUPING = 0
95+
96+# Thousand separator symbol
97+THOUSAND_SEPARATOR = ','
98+
99 # Do you want to manage transactions manually?
100 # Hint: you really don't!
101 TRANSACTIONS_MANAGED = False
102diff --git a/django/conf/locale/__init__.py b/django/conf/locale/__init__.py
103new file mode 100644
104index 0000000..e69de29
105diff --git a/django/conf/locale/ar/__init__.py b/django/conf/locale/ar/__init__.py
106new file mode 100644
107index 0000000..e69de29
108diff --git a/django/conf/locale/ar/formats.py b/django/conf/locale/ar/formats.py
109new file mode 100644
110index 0000000..d8d627f
111--- /dev/null
112+++ b/django/conf/locale/ar/formats.py
113@@ -0,0 +1,18 @@
114+# -*- encoding: utf-8 -*-
115+# This file is distributed under the same license as the Django package.
116+#
117+
118+DATE_FORMAT = 'j F، Y'
119+TIME_FORMAT = 'g:i:s A'
120+# DATETIME_FORMAT =
121+YEAR_MONTH_FORMAT = 'F Y'
122+MONTH_DAY_FORMAT = 'j F'
123+SHORT_DATE_FORMAT = 'd‏/m‏/Y'
124+# SHORT_DATETIME_FORMAT =
125+# FIRST_DAY_OF_WEEK =
126+# DATE_INPUT_FORMATS =
127+# TIME_INPUT_FORMATS =
128+# DATETIME_INPUT_FORMATS =
129+DECIMAL_SEPARATOR = ','
130+THOUSAND_SEPARATOR = '.'
131+# NUMBER_GROUPING =
132diff --git a/django/conf/locale/bg/__init__.py b/django/conf/locale/bg/__init__.py
133new file mode 100644
134index 0000000..e69de29
135diff --git a/django/conf/locale/bg/formats.py b/django/conf/locale/bg/formats.py
136new file mode 100644
137index 0000000..045543a
138--- /dev/null
139+++ b/django/conf/locale/bg/formats.py
140@@ -0,0 +1,18 @@
141+# -*- encoding: utf-8 -*-
142+# This file is distributed under the same license as the Django package.
143+#
144+
145+DATE_FORMAT = 'd F Y'
146+TIME_FORMAT = 'H:i:s'
147+# DATETIME_FORMAT =
148+# YEAR_MONTH_FORMAT =
149+MONTH_DAY_FORMAT = 'j F'
150+SHORT_DATE_FORMAT = 'd.m.Y'
151+# SHORT_DATETIME_FORMAT =
152+# FIRST_DAY_OF_WEEK =
153+# DATE_INPUT_FORMATS =
154+# TIME_INPUT_FORMATS =
155+# DATETIME_INPUT_FORMATS =
156+DECIMAL_SEPARATOR = ','
157+THOUSAND_SEPARATOR = ' '
158+# NUMBER_GROUPING =
159diff --git a/django/conf/locale/bn/__init__.py b/django/conf/locale/bn/__init__.py
160new file mode 100644
161index 0000000..e69de29
162diff --git a/django/conf/locale/bn/formats.py b/django/conf/locale/bn/formats.py
163new file mode 100644
164index 0000000..46e5da9
165--- /dev/null
166+++ b/django/conf/locale/bn/formats.py
167@@ -0,0 +1,18 @@
168+# -*- encoding: utf-8 -*-
169+# This file is distributed under the same license as the Django package.
170+#
171+
172+DATE_FORMAT = 'j F, Y'
173+TIME_FORMAT = 'g:i:s A'
174+# DATETIME_FORMAT =
175+YEAR_MONTH_FORMAT = 'F Y'
176+MONTH_DAY_FORMAT = 'j F'
177+SHORT_DATE_FORMAT = 'j M, Y'
178+# SHORT_DATETIME_FORMAT =
179+# FIRST_DAY_OF_WEEK =
180+# DATE_INPUT_FORMATS =
181+# TIME_INPUT_FORMATS =
182+# DATETIME_INPUT_FORMATS =
183+DECIMAL_SEPARATOR = '.'
184+THOUSAND_SEPARATOR = ','
185+# NUMBER_GROUPING =
186diff --git a/django/conf/locale/ca/__init__.py b/django/conf/locale/ca/__init__.py
187new file mode 100644
188index 0000000..e69de29
189diff --git a/django/conf/locale/ca/formats.py b/django/conf/locale/ca/formats.py
190new file mode 100644
191index 0000000..aebaea3
192--- /dev/null
193+++ b/django/conf/locale/ca/formats.py
194@@ -0,0 +1,30 @@
195+# -*- encoding: utf-8 -*-
196+# This file is distributed under the same license as the Django package.
197+#
198+
199+DATE_FORMAT = 'j \de F \de Y'
200+TIME_FORMAT = 'G:i:s'
201+DATETIME_FORMAT = 'j \de F \de Y \\a \le\s G:i'
202+YEAR_MONTH_FORMAT = 'F \de\l Y'
203+MONTH_DAY_FORMAT = 'j \de F'
204+SHORT_DATE_FORMAT = 'd/m/Y'
205+SHORT_DATETIME_FORMAT = 'd/m/Y G:i'
206+FIRST_DAY_OF_WEEK = 1 # Monday
207+DATE_INPUT_FORMATS = (
208+    # '31/12/2009', '31/12/09'
209+    '%d/%m/%Y', '%d/%m/%y'
210+)
211+TIME_INPUT_FORMATS = (
212+    # '14:30:59', '14:30'
213+    '%H:%M:%S', '%H:%M'
214+)
215+DATETIME_INPUT_FORMATS = (
216+    '%d/%m/%Y %H:%M:%S',
217+    '%d/%m/%Y %H:%M',
218+    '%d/%m/%y %H:%M:%S',
219+    '%d/%m/%y %H:%M',
220+)
221+DECIMAL_SEPARATOR = ','
222+THOUSAND_SEPARATOR = '.'
223+NUMBER_GROUPING = 3
224+
225diff --git a/django/conf/locale/cs/__init__.py b/django/conf/locale/cs/__init__.py
226new file mode 100644
227index 0000000..e69de29
228diff --git a/django/conf/locale/cs/formats.py b/django/conf/locale/cs/formats.py
229new file mode 100644
230index 0000000..327e77e
231--- /dev/null
232+++ b/django/conf/locale/cs/formats.py
233@@ -0,0 +1,18 @@
234+# -*- encoding: utf-8 -*-
235+# This file is distributed under the same license as the Django package.
236+#
237+
238+DATE_FORMAT = 'j. F Y'
239+TIME_FORMAT = 'G:i:s'
240+# DATETIME_FORMAT =
241+# YEAR_MONTH_FORMAT =
242+MONTH_DAY_FORMAT = 'j. F'
243+SHORT_DATE_FORMAT = 'j.n.Y'
244+# SHORT_DATETIME_FORMAT =
245+# FIRST_DAY_OF_WEEK =
246+# DATE_INPUT_FORMATS =
247+# TIME_INPUT_FORMATS =
248+# DATETIME_INPUT_FORMATS =
249+DECIMAL_SEPARATOR = ','
250+THOUSAND_SEPARATOR = ' '
251+# NUMBER_GROUPING =
252diff --git a/django/conf/locale/cy/__init__.py b/django/conf/locale/cy/__init__.py
253new file mode 100644
254index 0000000..e69de29
255diff --git a/django/conf/locale/cy/formats.py b/django/conf/locale/cy/formats.py
256new file mode 100644
257index 0000000..a58d81f
258--- /dev/null
259+++ b/django/conf/locale/cy/formats.py
260@@ -0,0 +1,18 @@
261+# -*- encoding: utf-8 -*-
262+# This file is distributed under the same license as the Django package.
263+#
264+
265+DATE_FORMAT = 'd F Y'
266+TIME_FORMAT = 'g:i:s A'
267+# DATETIME_FORMAT =
268+# YEAR_MONTH_FORMAT =
269+# MONTH_DAY_FORMAT =
270+SHORT_DATE_FORMAT = 'j M Y'
271+# SHORT_DATETIME_FORMAT =
272+# FIRST_DAY_OF_WEEK =
273+# DATE_INPUT_FORMATS =
274+# TIME_INPUT_FORMATS =
275+# DATETIME_INPUT_FORMATS =
276+# DECIMAL_SEPARATOR =
277+# THOUSAND_SEPARATOR =
278+# NUMBER_GROUPING =
279diff --git a/django/conf/locale/da/__init__.py b/django/conf/locale/da/__init__.py
280new file mode 100644
281index 0000000..e69de29
282diff --git a/django/conf/locale/da/formats.py b/django/conf/locale/da/formats.py
283new file mode 100644
284index 0000000..9982014
285--- /dev/null
286+++ b/django/conf/locale/da/formats.py
287@@ -0,0 +1,26 @@
288+# -*- encoding: utf-8 -*-
289+# This file is distributed under the same license as the Django package.
290+#
291+
292+DATE_FORMAT = 'j. F Y'
293+TIME_FORMAT = 'H:i'
294+DATETIME_FORMAT = 'j. F Y H:i'
295+YEAR_MONTH_FORMAT = 'F Y'
296+MONTH_DAY_FORMAT = 'j. F'
297+SHORT_DATE_FORMAT = 'd.m.Y'
298+SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
299+FIRST_DAY_OF_WEEK = 1
300+DATE_INPUT_FORMATS = (
301+    '%d.%m.%Y',                        # '25.10.2006'
302+)
303+TIME_INPUT_FORMATS = (
304+    '%H:%M:%S',                        # '14:30:59'
305+    '%H:%M',                           # '14:30'
306+)
307+DATETIME_INPUT_FORMATS = (
308+    '%d.%m.%Y %H:%M:%S',               # '25.10.2006 14:30:59'
309+    '%d.%m.%Y %H:%M',                  # '25.10.2006 14:30'
310+)
311+DECIMAL_SEPARATOR = ','
312+THOUSAND_SEPARATOR = '.'
313+NUMBER_GROUPING = 3
314diff --git a/django/conf/locale/de/__init__.py b/django/conf/locale/de/__init__.py
315new file mode 100644
316index 0000000..e69de29
317diff --git a/django/conf/locale/de/formats.py b/django/conf/locale/de/formats.py
318new file mode 100644
319index 0000000..89b5784
320--- /dev/null
321+++ b/django/conf/locale/de/formats.py
322@@ -0,0 +1,32 @@
323+# -*- encoding: utf-8 -*-
324+# This file is distributed under the same license as the Django package.
325+#
326+
327+DATE_FORMAT = 'j. F Y'
328+TIME_FORMAT = 'H:i:s'
329+DATETIME_FORMAT = 'j. F Y H:i:s'
330+YEAR_MONTH_FORMAT = 'F Y'
331+MONTH_DAY_FORMAT = 'j. F'
332+SHORT_DATE_FORMAT = 'd.m.Y'
333+SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
334+FIRST_DAY_OF_WEEK = 1 # Monday
335+DATE_INPUT_FORMATS = (
336+    '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
337+    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
338+    '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
339+)
340+TIME_INPUT_FORMATS = (
341+    '%H:%M:%S', # '14:30:59'
342+    '%H:%M',    # '14:30'
343+)
344+DATETIME_INPUT_FORMATS = (
345+    '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
346+    '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
347+    '%d.%m.%Y',             # '25.10.2006'
348+    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
349+    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
350+    '%Y-%m-%d',             # '2006-10-25'
351+)
352+DECIMAL_SEPARATOR = ','
353+THOUSAND_SEPARATOR = '.'
354+NUMBER_GROUPING = 3
355diff --git a/django/conf/locale/el/__init__.py b/django/conf/locale/el/__init__.py
356new file mode 100644
357index 0000000..e69de29
358diff --git a/django/conf/locale/el/formats.py b/django/conf/locale/el/formats.py
359new file mode 100644
360index 0000000..d476ab3
361--- /dev/null
362+++ b/django/conf/locale/el/formats.py
363@@ -0,0 +1,18 @@
364+# -*- encoding: utf-8 -*-
365+# This file is distributed under the same license as the Django package.
366+#
367+
368+DATE_FORMAT = 'd F Y'
369+TIME_FORMAT = 'g:i:s A'
370+# DATETIME_FORMAT =
371+YEAR_MONTH_FORMAT = 'F Y'
372+MONTH_DAY_FORMAT = 'j F'
373+SHORT_DATE_FORMAT = 'd M Y'
374+# SHORT_DATETIME_FORMAT =
375+# FIRST_DAY_OF_WEEK =
376+# DATE_INPUT_FORMATS =
377+# TIME_INPUT_FORMATS =
378+# DATETIME_INPUT_FORMATS =
379+DECIMAL_SEPARATOR = ','
380+THOUSAND_SEPARATOR = '.'
381+# NUMBER_GROUPING =
382diff --git a/django/conf/locale/en/__init__.py b/django/conf/locale/en/__init__.py
383new file mode 100644
384index 0000000..e69de29
385diff --git a/django/conf/locale/en/formats.py b/django/conf/locale/en/formats.py
386new file mode 100644
387index 0000000..3a507cd
388--- /dev/null
389+++ b/django/conf/locale/en/formats.py
390@@ -0,0 +1,38 @@
391+# -*- encoding: utf-8 -*-
392+# This file is distributed under the same license as the Django package.
393+#
394+
395+DATE_FORMAT = 'N j, Y'
396+TIME_FORMAT = 'P'
397+DATETIME_FORMAT = 'N j, Y, P'
398+YEAR_MONTH_FORMAT = 'F Y'
399+MONTH_DAY_FORMAT = 'F j'
400+SHORT_DATE_FORMAT = 'm/d/Y'
401+SHORT_DATETIME_FORMAT = 'm/d/Y P'
402+FIRST_DAY_OF_WEEK = 0 # Sunday
403+DATE_INPUT_FORMATS = (
404+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
405+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
406+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
407+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
408+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
409+)
410+TIME_INPUT_FORMATS = (
411+    '%H:%M:%S',     # '14:30:59'
412+    '%H:%M',        # '14:30'
413+)
414+DATETIME_INPUT_FORMATS = (
415+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
416+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
417+    '%Y-%m-%d',              # '2006-10-25'
418+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
419+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
420+    '%m/%d/%Y',              # '10/25/2006'
421+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
422+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
423+    '%m/%d/%y',              # '10/25/06'
424+)
425+DECIMAL_SEPARATOR = '.'
426+THOUSAND_SEPARATOR = ','
427+NUMBER_GROUPING = 3
428+
429diff --git a/django/conf/locale/es/__init__.py b/django/conf/locale/es/__init__.py
430new file mode 100644
431index 0000000..e69de29
432diff --git a/django/conf/locale/es/formats.py b/django/conf/locale/es/formats.py
433new file mode 100644
434index 0000000..349810f
435--- /dev/null
436+++ b/django/conf/locale/es/formats.py
437@@ -0,0 +1,30 @@
438+# -*- encoding: utf-8 -*-
439+# This file is distributed under the same license as the Django package.
440+#
441+
442+DATE_FORMAT = 'j \de F \de Y'
443+TIME_FORMAT = 'H:i:s'
444+DATETIME_FORMAT = 'j \de F \de Y \a \l\a\s H:i'
445+YEAR_MONTH_FORMAT = 'F \de Y'
446+MONTH_DAY_FORMAT = 'j \de F'
447+SHORT_DATE_FORMAT = 'd/m/Y'
448+SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
449+FIRST_DAY_OF_WEEK = 1 # Monday
450+DATE_INPUT_FORMATS = (
451+    # '31/12/2009', '31/12/09'
452+    '%d/%m/%Y', '%d/%m/%y'
453+)
454+TIME_INPUT_FORMATS = (
455+    # '14:30:59', '14:30'
456+    '%H:%M:%S', '%H:%M'
457+)
458+DATETIME_INPUT_FORMATS = (
459+    '%d/%m/%Y %H:%M:%S',
460+    '%d/%m/%Y %H:%M',
461+    '%d/%m/%y %H:%M:%S',
462+    '%d/%m/%y %H:%M',
463+)
464+DECIMAL_SEPARATOR = ','
465+THOUSAND_SEPARATOR = '.'
466+NUMBER_GROUPING = 3
467+
468diff --git a/django/conf/locale/es_AR/__init__.py b/django/conf/locale/es_AR/__init__.py
469new file mode 100644
470index 0000000..e69de29
471diff --git a/django/conf/locale/es_AR/formats.py b/django/conf/locale/es_AR/formats.py
472new file mode 100644
473index 0000000..6d71786
474--- /dev/null
475+++ b/django/conf/locale/es_AR/formats.py
476@@ -0,0 +1,18 @@
477+# -*- encoding: utf-8 -*-
478+# This file is distributed under the same license as the Django package.
479+#
480+
481+# DATE_FORMAT =
482+# TIME_FORMAT =
483+# DATETIME_FORMAT =
484+# YEAR_MONTH_FORMAT =
485+# MONTH_DAY_FORMAT =
486+# SHORT_DATE_FORMAT =
487+# SHORT_DATETIME_FORMAT =
488+# FIRST_DAY_OF_WEEK =
489+# DATE_INPUT_FORMATS =
490+# TIME_INPUT_FORMATS =
491+# DATETIME_INPUT_FORMATS =
492+# DECIMAL_SEPARATOR =
493+# THOUSAND_SEPARATOR =
494+# NUMBER_GROUPING =
495diff --git a/django/conf/locale/et/__init__.py b/django/conf/locale/et/__init__.py
496new file mode 100644
497index 0000000..e69de29
498diff --git a/django/conf/locale/et/formats.py b/django/conf/locale/et/formats.py
499new file mode 100644
500index 0000000..b96420c
501--- /dev/null
502+++ b/django/conf/locale/et/formats.py
503@@ -0,0 +1,18 @@
504+# -*- encoding: utf-8 -*-
505+# This file is distributed under the same license as the Django package.
506+#
507+
508+DATE_FORMAT = 'j F Y'
509+TIME_FORMAT = 'G:i:s'
510+# DATETIME_FORMAT =
511+# YEAR_MONTH_FORMAT =
512+MONTH_DAY_FORMAT = 'j F'
513+SHORT_DATE_FORMAT = 'd.m.Y'
514+# SHORT_DATETIME_FORMAT =
515+# FIRST_DAY_OF_WEEK =
516+# DATE_INPUT_FORMATS =
517+# TIME_INPUT_FORMATS =
518+# DATETIME_INPUT_FORMATS =
519+DECIMAL_SEPARATOR = ','
520+THOUSAND_SEPARATOR = ' '
521+# NUMBER_GROUPING =
522diff --git a/django/conf/locale/eu/__init__.py b/django/conf/locale/eu/__init__.py
523new file mode 100644
524index 0000000..e69de29
525diff --git a/django/conf/locale/eu/formats.py b/django/conf/locale/eu/formats.py
526new file mode 100644
527index 0000000..475f924
528--- /dev/null
529+++ b/django/conf/locale/eu/formats.py
530@@ -0,0 +1,18 @@
531+# -*- encoding: utf-8 -*-
532+# This file is distributed under the same license as the Django package.
533+#
534+
535+DATE_FORMAT = 'Yeko M\re\n d\a'
536+TIME_FORMAT = 'H:i:s'
537+# DATETIME_FORMAT =
538+# YEAR_MONTH_FORMAT =
539+# MONTH_DAY_FORMAT =
540+SHORT_DATE_FORMAT = 'Y M j'
541+# SHORT_DATETIME_FORMAT =
542+# FIRST_DAY_OF_WEEK =
543+# DATE_INPUT_FORMATS =
544+# TIME_INPUT_FORMATS =
545+# DATETIME_INPUT_FORMATS =
546+DECIMAL_SEPARATOR = ','
547+THOUSAND_SEPARATOR = '.'
548+# NUMBER_GROUPING =
549diff --git a/django/conf/locale/fa/__init__.py b/django/conf/locale/fa/__init__.py
550new file mode 100644
551index 0000000..e69de29
552diff --git a/django/conf/locale/fa/formats.py b/django/conf/locale/fa/formats.py
553new file mode 100644
554index 0000000..dc11281
555--- /dev/null
556+++ b/django/conf/locale/fa/formats.py
557@@ -0,0 +1,18 @@
558+# -*- encoding: utf-8 -*-
559+# This file is distributed under the same license as the Django package.
560+#
561+
562+DATE_FORMAT = 'j F Y'
563+TIME_FORMAT = 'G:i:s'
564+DATETIME_FORMAT = 'j F Y، ساعت G:i:s'
565+YEAR_MONTH_FORMAT = 'F Y'
566+MONTH_DAY_FORMAT = 'j F'
567+SHORT_DATE_FORMAT = 'Y/n/j'
568+SHORT_DATETIME_FORMAT = 'Y/n/j،‏ G:i:s'
569+# FIRST_DAY_OF_WEEK =
570+# DATE_INPUT_FORMATS =
571+# TIME_INPUT_FORMATS =
572+# DATETIME_INPUT_FORMATS =
573+DECIMAL_SEPARATOR = ','
574+THOUSAND_SEPARATOR = '.'
575+# NUMBER_GROUPING =
576diff --git a/django/conf/locale/fi/__init__.py b/django/conf/locale/fi/__init__.py
577new file mode 100644
578index 0000000..e69de29
579diff --git a/django/conf/locale/fi/formats.py b/django/conf/locale/fi/formats.py
580new file mode 100644
581index 0000000..670e268
582--- /dev/null
583+++ b/django/conf/locale/fi/formats.py
584@@ -0,0 +1,18 @@
585+# -*- encoding: utf-8 -*-
586+# This file is distributed under the same license as the Django package.
587+#
588+
589+DATE_FORMAT = 'j. F Y'
590+TIME_FORMAT = 'G.i.s'
591+# DATETIME_FORMAT =
592+YEAR_MONTH_FORMAT = 'F Y'
593+MONTH_DAY_FORMAT = 'j. F'
594+SHORT_DATE_FORMAT = 'j.n.Y'
595+# SHORT_DATETIME_FORMAT =
596+# FIRST_DAY_OF_WEEK =
597+# DATE_INPUT_FORMATS =
598+# TIME_INPUT_FORMATS =
599+# DATETIME_INPUT_FORMATS =
600+DECIMAL_SEPARATOR = ','
601+THOUSAND_SEPARATOR = ' '
602+# NUMBER_GROUPING =
603diff --git a/django/conf/locale/fr/__init__.py b/django/conf/locale/fr/__init__.py
604new file mode 100644
605index 0000000..e69de29
606diff --git a/django/conf/locale/fr/formats.py b/django/conf/locale/fr/formats.py
607new file mode 100644
608index 0000000..1d670d7
609--- /dev/null
610+++ b/django/conf/locale/fr/formats.py
611@@ -0,0 +1,18 @@
612+# -*- encoding: utf-8 -*-
613+# This file is distributed under the same license as the Django package.
614+#
615+
616+DATE_FORMAT = 'j F Y'
617+TIME_FORMAT = 'H:i:s'
618+DATETIME_FORMAT = 'j F Y H:i:s'
619+YEAR_MONTH_FORMAT = 'F Y'
620+MONTH_DAY_FORMAT = 'j F'
621+SHORT_DATE_FORMAT = 'j M Y'
622+SHORT_DATETIME_FORMAT = 'j M Y H:i:s'
623+# FIRST_DAY_OF_WEEK =
624+# DATE_INPUT_FORMATS =
625+# TIME_INPUT_FORMATS =
626+# DATETIME_INPUT_FORMATS =
627+DECIMAL_SEPARATOR = ','
628+THOUSAND_SEPARATOR = ' '
629+# NUMBER_GROUPING =
630diff --git a/django/conf/locale/ga/__init__.py b/django/conf/locale/ga/__init__.py
631new file mode 100644
632index 0000000..e69de29
633diff --git a/django/conf/locale/ga/formats.py b/django/conf/locale/ga/formats.py
634new file mode 100644
635index 0000000..f177bb2
636--- /dev/null
637+++ b/django/conf/locale/ga/formats.py
638@@ -0,0 +1,18 @@
639+# -*- encoding: utf-8 -*-
640+# This file is distributed under the same license as the Django package.
641+#
642+
643+DATE_FORMAT = 'j F Y'
644+TIME_FORMAT = 'H:i:s'
645+# DATETIME_FORMAT =
646+# YEAR_MONTH_FORMAT =
647+MONTH_DAY_FORMAT = 'j F'
648+SHORT_DATE_FORMAT = 'j M Y'
649+# SHORT_DATETIME_FORMAT =
650+# FIRST_DAY_OF_WEEK =
651+# DATE_INPUT_FORMATS =
652+# TIME_INPUT_FORMATS =
653+# DATETIME_INPUT_FORMATS =
654+DECIMAL_SEPARATOR = '.'
655+THOUSAND_SEPARATOR = ','
656+# NUMBER_GROUPING =
657diff --git a/django/conf/locale/gl/__init__.py b/django/conf/locale/gl/__init__.py
658new file mode 100644
659index 0000000..e69de29
660diff --git a/django/conf/locale/gl/formats.py b/django/conf/locale/gl/formats.py
661new file mode 100644
662index 0000000..e0a95d5
663--- /dev/null
664+++ b/django/conf/locale/gl/formats.py
665@@ -0,0 +1,18 @@
666+# -*- encoding: utf-8 -*-
667+# This file is distributed under the same license as the Django package.
668+#
669+
670+DATE_FORMAT = 'd F Y'
671+TIME_FORMAT = 'H:i:s'
672+# DATETIME_FORMAT =
673+YEAR_MONTH_FORMAT = 'F Y'
674+MONTH_DAY_FORMAT = 'j F'
675+SHORT_DATE_FORMAT = 'j M, Y'
676+# SHORT_DATETIME_FORMAT =
677+# FIRST_DAY_OF_WEEK =
678+# DATE_INPUT_FORMATS =
679+# TIME_INPUT_FORMATS =
680+# DATETIME_INPUT_FORMATS =
681+DECIMAL_SEPARATOR = ','
682+THOUSAND_SEPARATOR = '.'
683+# NUMBER_GROUPING =
684diff --git a/django/conf/locale/he/__init__.py b/django/conf/locale/he/__init__.py
685new file mode 100644
686index 0000000..e69de29
687diff --git a/django/conf/locale/he/formats.py b/django/conf/locale/he/formats.py
688new file mode 100644
689index 0000000..8d7c7f2
690--- /dev/null
691+++ b/django/conf/locale/he/formats.py
692@@ -0,0 +1,18 @@
693+# -*- encoding: utf-8 -*-
694+# This file is distributed under the same license as the Django package.
695+#
696+
697+DATE_FORMAT = 'j בF Y'
698+TIME_FORMAT = 'H:i:s'
699+DATETIME_FORMAT = 'j בF Y H:i:s'
700+YEAR_MONTH_FORMAT = 'F Y'
701+MONTH_DAY_FORMAT = 'j בF'
702+SHORT_DATE_FORMAT = 'd/m/Y'
703+SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s'
704+# FIRST_DAY_OF_WEEK =
705+# DATE_INPUT_FORMATS =
706+# TIME_INPUT_FORMATS =
707+# DATETIME_INPUT_FORMATS =
708+DECIMAL_SEPARATOR = '.'
709+THOUSAND_SEPARATOR = ','
710+# NUMBER_GROUPING =
711diff --git a/django/conf/locale/hi/__init__.py b/django/conf/locale/hi/__init__.py
712new file mode 100644
713index 0000000..e69de29
714diff --git a/django/conf/locale/hi/formats.py b/django/conf/locale/hi/formats.py
715new file mode 100644
716index 0000000..6afa258
717--- /dev/null
718+++ b/django/conf/locale/hi/formats.py
719@@ -0,0 +1,18 @@
720+# -*- encoding: utf-8 -*-
721+# This file is distributed under the same license as the Django package.
722+#
723+
724+DATE_FORMAT = 'j F Y'
725+TIME_FORMAT = 'g:i:s A'
726+# DATETIME_FORMAT =
727+# YEAR_MONTH_FORMAT =
728+MONTH_DAY_FORMAT = 'j F'
729+SHORT_DATE_FORMAT = 'd-m-Y'
730+# SHORT_DATETIME_FORMAT =
731+# FIRST_DAY_OF_WEEK =
732+# DATE_INPUT_FORMATS =
733+# TIME_INPUT_FORMATS =
734+# DATETIME_INPUT_FORMATS =
735+DECIMAL_SEPARATOR = '.'
736+THOUSAND_SEPARATOR = ','
737+# NUMBER_GROUPING =
738diff --git a/django/conf/locale/hr/__init__.py b/django/conf/locale/hr/__init__.py
739new file mode 100644
740index 0000000..e69de29
741diff --git a/django/conf/locale/hr/formats.py b/django/conf/locale/hr/formats.py
742new file mode 100644
743index 0000000..62d1a7e
744--- /dev/null
745+++ b/django/conf/locale/hr/formats.py
746@@ -0,0 +1,18 @@
747+# -*- encoding: utf-8 -*-
748+# This file is distributed under the same license as the Django package.
749+#
750+
751+DATE_FORMAT = 'j. F Y.'
752+TIME_FORMAT = 'H:i:s'
753+# DATETIME_FORMAT =
754+YEAR_MONTH_FORMAT = 'F Y.'
755+MONTH_DAY_FORMAT = 'j. F'
756+SHORT_DATE_FORMAT = 'j.n.Y.'
757+# SHORT_DATETIME_FORMAT =
758+# FIRST_DAY_OF_WEEK =
759+# DATE_INPUT_FORMATS =
760+# TIME_INPUT_FORMATS =
761+# DATETIME_INPUT_FORMATS =
762+DECIMAL_SEPARATOR = ','
763+THOUSAND_SEPARATOR = '.'
764+# NUMBER_GROUPING =
765diff --git a/django/conf/locale/hu/__init__.py b/django/conf/locale/hu/__init__.py
766new file mode 100644
767index 0000000..e69de29
768diff --git a/django/conf/locale/hu/formats.py b/django/conf/locale/hu/formats.py
769new file mode 100644
770index 0000000..6ee2db0
771--- /dev/null
772+++ b/django/conf/locale/hu/formats.py
773@@ -0,0 +1,18 @@
774+# -*- encoding: utf-8 -*-
775+# This file is distributed under the same license as the Django package.
776+#
777+
778+DATE_FORMAT = 'Y. F j.'
779+TIME_FORMAT = 'G:i:s'
780+# DATETIME_FORMAT =
781+# YEAR_MONTH_FORMAT =
782+MONTH_DAY_FORMAT = 'F j.'
783+SHORT_DATE_FORMAT = 'Y.m.d.'
784+# SHORT_DATETIME_FORMAT =
785+# FIRST_DAY_OF_WEEK =
786+# DATE_INPUT_FORMATS =
787+# TIME_INPUT_FORMATS =
788+# DATETIME_INPUT_FORMATS =
789+DECIMAL_SEPARATOR = ','
790+THOUSAND_SEPARATOR = ' '
791+# NUMBER_GROUPING =
792diff --git a/django/conf/locale/is/__init__.py b/django/conf/locale/is/__init__.py
793new file mode 100644
794index 0000000..e69de29
795diff --git a/django/conf/locale/is/formats.py b/django/conf/locale/is/formats.py
796new file mode 100644
797index 0000000..b6377db
798--- /dev/null
799+++ b/django/conf/locale/is/formats.py
800@@ -0,0 +1,18 @@
801+# -*- encoding: utf-8 -*-
802+# This file is distributed under the same license as the Django package.
803+#
804+
805+DATE_FORMAT = 'j. F Y'
806+TIME_FORMAT = 'H:i:s'
807+# DATETIME_FORMAT =
808+YEAR_MONTH_FORMAT = 'F Y'
809+MONTH_DAY_FORMAT = 'j. F'
810+SHORT_DATE_FORMAT = 'j.n.Y'
811+# SHORT_DATETIME_FORMAT =
812+# FIRST_DAY_OF_WEEK =
813+# DATE_INPUT_FORMATS =
814+# TIME_INPUT_FORMATS =
815+# DATETIME_INPUT_FORMATS =
816+DECIMAL_SEPARATOR = ','
817+THOUSAND_SEPARATOR = '.'
818+# NUMBER_GROUPING =
819diff --git a/django/conf/locale/it/__init__.py b/django/conf/locale/it/__init__.py
820new file mode 100644
821index 0000000..e69de29
822diff --git a/django/conf/locale/it/formats.py b/django/conf/locale/it/formats.py
823new file mode 100644
824index 0000000..fe86b5b
825--- /dev/null
826+++ b/django/conf/locale/it/formats.py
827@@ -0,0 +1,18 @@
828+# -*- encoding: utf-8 -*-
829+# This file is distributed under the same license as the Django package.
830+#
831+
832+DATE_FORMAT = 'd F Y'
833+TIME_FORMAT = 'H.i.s'
834+# DATETIME_FORMAT =
835+YEAR_MONTH_FORMAT = 'F Y'
836+MONTH_DAY_FORMAT = 'j F'
837+SHORT_DATE_FORMAT = 'd/M/Y'
838+# SHORT_DATETIME_FORMAT =
839+# FIRST_DAY_OF_WEEK =
840+# DATE_INPUT_FORMATS =
841+# TIME_INPUT_FORMATS =
842+# DATETIME_INPUT_FORMATS =
843+DECIMAL_SEPARATOR = ','
844+THOUSAND_SEPARATOR = '.'
845+# NUMBER_GROUPING =
846diff --git a/django/conf/locale/ja/__init__.py b/django/conf/locale/ja/__init__.py
847new file mode 100644
848index 0000000..e69de29
849diff --git a/django/conf/locale/ja/formats.py b/django/conf/locale/ja/formats.py
850new file mode 100644
851index 0000000..853056d
852--- /dev/null
853+++ b/django/conf/locale/ja/formats.py
854@@ -0,0 +1,18 @@
855+# -*- encoding: utf-8 -*-
856+# This file is distributed under the same license as the Django package.
857+#
858+
859+DATE_FORMAT = 'Y年n月j日'
860+TIME_FORMAT = 'G:i:s'
861+DATETIME_FORMAT = 'Y年n月j日G:i:s'
862+YEAR_MONTH_FORMAT = 'Y年n月'
863+MONTH_DAY_FORMAT = 'n月j日'
864+SHORT_DATE_FORMAT = 'Y/m/d'
865+SHORT_DATETIME_FORMAT = 'Y/m/d G:i:s'
866+# FIRST_DAY_OF_WEEK =
867+# DATE_INPUT_FORMATS =
868+# TIME_INPUT_FORMATS =
869+# DATETIME_INPUT_FORMATS =
870+DECIMAL_SEPARATOR = '.'
871+THOUSAND_SEPARATOR = ','
872+# NUMBER_GROUPING =
873diff --git a/django/conf/locale/ka/__init__.py b/django/conf/locale/ka/__init__.py
874new file mode 100644
875index 0000000..e69de29
876diff --git a/django/conf/locale/ka/formats.py b/django/conf/locale/ka/formats.py
877new file mode 100644
878index 0000000..665a73f
879--- /dev/null
880+++ b/django/conf/locale/ka/formats.py
881@@ -0,0 +1,42 @@
882+# -*- encoding: utf-8 -*-
883+# This file is distributed under the same license as the Django package.
884+#
885+
886+DATE_FORMAT = 'l, j F, Y'
887+TIME_FORMAT = 'h:i:s a'
888+DATETIME_FORMAT = 'j F, Y h:i:s a'
889+YEAR_MONTH_FORMAT = 'F, Y'
890+MONTH_DAY_FORMAT = 'j F'
891+SHORT_DATE_FORMAT = 'j.M.Y'
892+SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s'
893+FIRST_DAY_OF_WEEK = 1 # (Monday)
894+DATE_INPUT_FORMATS = (
895+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y',     # '2006-10-25', '10/25/2006', '10/25/06'
896+    '%d %b %Y', '%d %b, %Y', '%d %b. %Y',   # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
897+    '%d %B %Y', '%d %B, %Y',                # '25 October 2006', '25 October, 2006'
898+    '%d.%m.%Y', '%d.%m.%y',                 # '25.10.2006', '25.10.06'
899+)
900+TIME_INPUT_FORMATS = (
901+    '%H:%M:%S',     # '14:30:59'
902+    '%H:%M',        # '14:30'
903+)
904+DATETIME_INPUT_FORMATS = (
905+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
906+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
907+    '%Y-%m-%d',              # '2006-10-25'
908+    '%d.%m.%Y %H:%M:%S',     # '25.10.2006 14:30:59'
909+    '%d.%m.%Y %H:%M',        # '25.10.2006 14:30'
910+    '%d.%m.%Y',              # '25.10.2006'
911+    '%d.%m.%y %H:%M:%S',     # '25.10.06 14:30:59'
912+    '%d.%m.%y %H:%M',        # '25.10.06 14:30'
913+    '%d.%m.%y',              # '25.10.06'
914+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
915+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
916+    '%m/%d/%Y',              # '10/25/2006'
917+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
918+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
919+    '%m/%d/%y',              # '10/25/06'
920+)
921+DECIMAL_SEPARATOR = '.'
922+THOUSAND_SEPARATOR = " "
923+NUMBER_GROUPING = 3
924diff --git a/django/conf/locale/km/__init__.py b/django/conf/locale/km/__init__.py
925new file mode 100644
926index 0000000..e69de29
927diff --git a/django/conf/locale/km/formats.py b/django/conf/locale/km/formats.py
928new file mode 100644
929index 0000000..3736d57
930--- /dev/null
931+++ b/django/conf/locale/km/formats.py
932@@ -0,0 +1,18 @@
933+# -*- encoding: utf-8 -*-
934+# This file is distributed under the same license as the Django package.
935+#
936+
937+DATE_FORMAT = 'j ខែ F ឆ្នាំ Y'
938+TIME_FORMAT = 'G:i:s'
939+DATETIME_FORMAT = 'j ខែ F ឆ្នាំ Y, G:i:s'
940+# YEAR_MONTH_FORMAT =
941+MONTH_DAY_FORMAT = 'j F'
942+SHORT_DATE_FORMAT = 'j M Y'
943+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
944+# FIRST_DAY_OF_WEEK =
945+# DATE_INPUT_FORMATS =
946+# TIME_INPUT_FORMATS =
947+# DATETIME_INPUT_FORMATS =
948+DECIMAL_SEPARATOR = ','
949+THOUSAND_SEPARATOR = '.'
950+# NUMBER_GROUPING =
951diff --git a/django/conf/locale/kn/__init__.py b/django/conf/locale/kn/__init__.py
952new file mode 100644
953index 0000000..e69de29
954diff --git a/django/conf/locale/kn/formats.py b/django/conf/locale/kn/formats.py
955new file mode 100644
956index 0000000..fa7a7b9
957--- /dev/null
958+++ b/django/conf/locale/kn/formats.py
959@@ -0,0 +1,18 @@
960+# -*- encoding: utf-8 -*-
961+# This file is distributed under the same license as the Django package.
962+#
963+
964+DATE_FORMAT = 'j F Y'
965+TIME_FORMAT = 'h:i:s A'
966+# DATETIME_FORMAT =
967+# YEAR_MONTH_FORMAT =
968+MONTH_DAY_FORMAT = 'j F'
969+SHORT_DATE_FORMAT = 'j M Y'
970+# SHORT_DATETIME_FORMAT =
971+# FIRST_DAY_OF_WEEK =
972+# DATE_INPUT_FORMATS =
973+# TIME_INPUT_FORMATS =
974+# DATETIME_INPUT_FORMATS =
975+# DECIMAL_SEPARATOR =
976+# THOUSAND_SEPARATOR =
977+# NUMBER_GROUPING =
978diff --git a/django/conf/locale/ko/__init__.py b/django/conf/locale/ko/__init__.py
979new file mode 100644
980index 0000000..e69de29
981diff --git a/django/conf/locale/ko/formats.py b/django/conf/locale/ko/formats.py
982new file mode 100644
983index 0000000..619047d
984--- /dev/null
985+++ b/django/conf/locale/ko/formats.py
986@@ -0,0 +1,44 @@
987+# -*- encoding: utf-8 -*-
988+# This file is distributed under the same license as the Django package.
989+#
990+
991+DATE_FORMAT = 'Y년 n월 j일'
992+TIME_FORMAT = 'A g:i:s'
993+DATETIME_FORMAT = 'Y년 n월 j일 g:i:s A'
994+YEAR_MONTH_FORMAT = 'Y년 F월'
995+MONTH_DAY_FORMAT = 'F월 j일'
996+SHORT_DATE_FORMAT = 'Y-n-j.'
997+SHORT_DATETIME_FORMAT = 'Y-n-j H:i'
998+# FIRST_DAY_OF_WEEK =
999+DATE_INPUT_FORMATS = (
1000+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
1001+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
1002+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
1003+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
1004+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
1005+    '%Y년 %m월 %d일',                   # '2006년 10월 25일', with localized suffix.
1006+)
1007+TIME_INPUT_FORMATS = (
1008+    '%H:%M:%S',     # '14:30:59'
1009+    '%H:%M',        # '14:30'
1010+    '%H시 %M분 %S초',   # '14시 30분 59초'
1011+    '%H시 %M분',        # '14시 30분'
1012+)
1013+DATETIME_INPUT_FORMATS = (
1014+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
1015+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
1016+    '%Y-%m-%d',              # '2006-10-25'
1017+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
1018+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
1019+    '%m/%d/%Y',              # '10/25/2006'
1020+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
1021+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
1022+    '%m/%d/%y',              # '10/25/06'
1023+
1024+    '%Y년 %m월 %d일 %H시 %M분 %S초',  # '2006년 10월 25일 14시 30분 59초'
1025+    '%Y년 %m월 %d일 %H시 %M분',       # '2006년 10월 25일 14시 30분'
1026+)
1027+
1028+DECIMAL_SEPARATOR = '.'
1029+THOUSAND_SEPARATOR = ','
1030+NUMBER_GROUPING = 3
1031diff --git a/django/conf/locale/lt/__init__.py b/django/conf/locale/lt/__init__.py
1032new file mode 100644
1033index 0000000..e69de29
1034diff --git a/django/conf/locale/lt/formats.py b/django/conf/locale/lt/formats.py
1035new file mode 100644
1036index 0000000..d9fb0c8
1037--- /dev/null
1038+++ b/django/conf/locale/lt/formats.py
1039@@ -0,0 +1,18 @@
1040+# -*- encoding: utf-8 -*-
1041+# This file is distributed under the same license as the Django package.
1042+#
1043+
1044+DATE_FORMAT = 'Y \m. F j \d.'
1045+TIME_FORMAT = 'H:i:s'
1046+# DATETIME_FORMAT =
1047+# YEAR_MONTH_FORMAT =
1048+# MONTH_DAY_FORMAT =
1049+SHORT_DATE_FORMAT = 'Y.m.d'
1050+# SHORT_DATETIME_FORMAT =
1051+# FIRST_DAY_OF_WEEK =
1052+# DATE_INPUT_FORMATS =
1053+# TIME_INPUT_FORMATS =
1054+# DATETIME_INPUT_FORMATS =
1055+DECIMAL_SEPARATOR = ','
1056+THOUSAND_SEPARATOR = '.'
1057+# NUMBER_GROUPING =
1058diff --git a/django/conf/locale/lv/__init__.py b/django/conf/locale/lv/__init__.py
1059new file mode 100644
1060index 0000000..e69de29
1061diff --git a/django/conf/locale/lv/formats.py b/django/conf/locale/lv/formats.py
1062new file mode 100644
1063index 0000000..5dc211c
1064--- /dev/null
1065+++ b/django/conf/locale/lv/formats.py
1066@@ -0,0 +1,18 @@
1067+# -*- encoding: utf-8 -*-
1068+# This file is distributed under the same license as the Django package.
1069+#
1070+
1071+DATE_FORMAT = 'Y. \g\a\d\a j. F'
1072+TIME_FORMAT = 'H:i:s'
1073+# DATETIME_FORMAT =
1074+YEAR_MONTH_FORMAT = 'Y. \g. F'
1075+MONTH_DAY_FORMAT = 'j. F'
1076+SHORT_DATE_FORMAT = 'Y. \g\a\d\a j. M'
1077+# SHORT_DATETIME_FORMAT =
1078+# FIRST_DAY_OF_WEEK =
1079+# DATE_INPUT_FORMATS =
1080+# TIME_INPUT_FORMATS =
1081+# DATETIME_INPUT_FORMATS =
1082+DECIMAL_SEPARATOR = ','
1083+THOUSAND_SEPARATOR = ' '
1084+# NUMBER_GROUPING =
1085diff --git a/django/conf/locale/mk/__init__.py b/django/conf/locale/mk/__init__.py
1086new file mode 100644
1087index 0000000..e69de29
1088diff --git a/django/conf/locale/mk/formats.py b/django/conf/locale/mk/formats.py
1089new file mode 100644
1090index 0000000..746ac0e
1091--- /dev/null
1092+++ b/django/conf/locale/mk/formats.py
1093@@ -0,0 +1,18 @@
1094+# -*- encoding: utf-8 -*-
1095+# This file is distributed under the same license as the Django package.
1096+#
1097+
1098+DATE_FORMAT = 'd F Y'
1099+TIME_FORMAT = 'H:i:s'
1100+# DATETIME_FORMAT =
1101+# YEAR_MONTH_FORMAT =
1102+# MONTH_DAY_FORMAT =
1103+SHORT_DATE_FORMAT = 'd.n.Y'
1104+# SHORT_DATETIME_FORMAT =
1105+# FIRST_DAY_OF_WEEK =
1106+# DATE_INPUT_FORMATS =
1107+# TIME_INPUT_FORMATS =
1108+# DATETIME_INPUT_FORMATS =
1109+DECIMAL_SEPARATOR = ','
1110+THOUSAND_SEPARATOR = '.'
1111+# NUMBER_GROUPING =
1112diff --git a/django/conf/locale/nl/__init__.py b/django/conf/locale/nl/__init__.py
1113new file mode 100644
1114index 0000000..e69de29
1115diff --git a/django/conf/locale/nl/formats.py b/django/conf/locale/nl/formats.py
1116new file mode 100644
1117index 0000000..dcef8c1
1118--- /dev/null
1119+++ b/django/conf/locale/nl/formats.py
1120@@ -0,0 +1,48 @@
1121+# -*- encoding: utf-8 -*-
1122+# This file is distributed under the same license as the Django package.
1123+#
1124+
1125+DATE_FORMAT = 'j F Y'                   # '20 januari 2009'
1126+TIME_FORMAT = 'H:i'                     # '15:23'
1127+DATETIME_FORMAT = 'j F Y H:i'           # '20 januari 2009 15:23'
1128+YEAR_MONTH_FORMAT = 'F Y'               # 'januari 2009'
1129+MONTH_DAY_FORMAT = 'j F'                # '20 januari'
1130+SHORT_DATE_FORMAT = 'j-n-Y'             # '20-1-2009'
1131+SHORT_DATETIME_FORMAT = 'j-n-Y H:i'     # '20-1-2009 15:23'
1132+FIRST_DAY_OF_WEEK = 1                   # Monday (in Dutch 'maandag')
1133+DATE_INPUT_FORMATS = (
1134+    '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d', # '20-01-2009', '20-01-09', '2009-01-20'
1135+    '%d %b %Y', '%d %b %y',             # '20 jan 2009', '20 jan 09'
1136+    '%d %B %Y', '%d %B %y',             # '20 januari 2009', '20 januari 09'
1137+)
1138+TIME_INPUT_FORMATS = (
1139+    '%H:%M:%S',                         # '15:23:35'
1140+    '%H.%M:%S',                         # '15.23:35'
1141+    '%H.%M',                            # '15.23'
1142+    '%H:%M',                            # '15:23'
1143+)
1144+DATETIME_INPUT_FORMATS = (
1145+    # With time in %H:%M:%S :
1146+    '%d-%m-%Y %H:%M:%S', '%d-%m-%y %H:%M:%S', '%Y-%m-%d %H:%M:%S',  # '20-01-2009 15:23:35', '20-01-09 15:23:35', '2009-01-20 15:23:35'
1147+    '%d %b %Y %H:%M:%S', '%d %b %y %H:%M:%S',   # '20 jan 2009 15:23:35', '20 jan 09 15:23:35'
1148+    '%d %B %Y %H:%M:%S', '%d %B %y %H:%M:%S',   # '20 januari 2009 15:23:35', '20 januari 2009 15:23:35'
1149+    # With time in %H.%M:%S :
1150+    '%d-%m-%Y %H.%M:%S', '%d-%m-%y %H.%M:%S',   # '20-01-2009 15.23:35', '20-01-09 15.23:35'
1151+    '%d %b %Y %H.%M:%S', '%d %b %y %H.%M:%S',   # '20 jan 2009 15.23:35', '20 jan 09 15.23:35'
1152+    '%d %B %Y %H.%M:%S', '%d %B %y %H.%M:%S',   # '20 januari 2009 15.23:35', '20 januari 2009 15.23:35'
1153+    # With time in %H:%M :
1154+    '%d-%m-%Y %H:%M', '%d-%m-%y %H:%M', '%Y-%m-%d %H:%M',   # '20-01-2009 15:23', '20-01-09 15:23', '2009-01-20 15:23'
1155+    '%d %b %Y %H:%M', '%d %b %y %H:%M',         # '20 jan 2009 15:23', '20 jan 09 15:23'
1156+    '%d %B %Y %H:%M', '%d %B %y %H:%M',         # '20 januari 2009 15:23', '20 januari 2009 15:23'
1157+    # With time in %H.%M :
1158+    '%d-%m-%Y %H.%M', '%d-%m-%y %H.%M',         # '20-01-2009 15.23', '20-01-09 15.23'
1159+    '%d %b %Y %H.%M', '%d %b %y %H.%M',         # '20 jan 2009 15.23', '20 jan 09 15.23'
1160+    '%d %B %Y %H.%M', '%d %B %y %H.%M',         # '20 januari 2009 15.23', '20 januari 2009 15.23'
1161+    # Without time :
1162+    '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d',         # '20-01-2009', '20-01-09', '2009-01-20'
1163+    '%d %b %Y', '%d %b %y',                     # '20 jan 2009', '20 jan 09'
1164+    '%d %B %Y', '%d %B %y',                     # '20 januari 2009', '20 januari 2009'
1165+)
1166+DECIMAL_SEPARATOR = ','
1167+THOUSAND_SEPARATOR = '.'
1168+NUMBER_GROUPING = 3
1169diff --git a/django/conf/locale/no/__init__.py b/django/conf/locale/no/__init__.py
1170new file mode 100644
1171index 0000000..e69de29
1172diff --git a/django/conf/locale/no/formats.py b/django/conf/locale/no/formats.py
1173new file mode 100644
1174index 0000000..62ee886
1175--- /dev/null
1176+++ b/django/conf/locale/no/formats.py
1177@@ -0,0 +1,34 @@
1178+DATE_FORMAT = 'j. F Y'
1179+TIME_FORMAT = 'H:i'
1180+DATETIME_FORMAT = 'j. F Y H:i'
1181+YEAR_MONTH_FORMAT = 'F Y'
1182+MONTH_DAY_FORMAT = 'j. F'
1183+SHORT_DATE_FORMAT = 'd.m.Y'
1184+SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
1185+FIRST_DAY_OF_WEEK = 1 # Monday
1186+DATE_INPUT_FORMATS = (
1187+    '%Y-%m-%d', '%j.%m.%Y', '%j.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
1188+    '%Y-%m-%j',                         # '2006-10-25',
1189+    '%j. %b %Y', '%j %b %Y',            # '25. okt 2006', '25 okt 2006'
1190+    '%j. %b. %Y', '%j %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
1191+    '%j. %B %Y', '%j %B %Y',            # '25. oktober 2006', '25 oktober 2006'
1192+)
1193+TIME_INPUT_FORMATS = (
1194+    '%H:%i:%S',     # '14:30:59'
1195+    '%H:%i',     # '14:30'
1196+)
1197+DATETIME_INPUT_FORMATS = (
1198+    '%Y-%m-%d %H:%i:%S',     # '2006-10-25 14:30:59'
1199+    '%Y-%m-%d %H:%i',        # '2006-10-25 14:30'
1200+    '%Y-%m-%d',              # '2006-10-25'
1201+    '%Y-%m-%j',              # '2006-10-25'
1202+    '%j.%m.%Y %H:%i:%S',     # '25.10.2006 14:30:59'
1203+    '%j.%m.%Y %H:%i',        # '25.10.2006 14:30'
1204+    '%j.%m.%Y',              # '25.10.2006'
1205+    '%j.%m.%y %H:%i:%S',     # '25.10.06 14:30:59'
1206+    '%j.%m.%y %H:%i',        # '25.10.06 14:30'
1207+    '%j.%m.%y',              # '25.10.06'
1208+)
1209+DECIMAL_SEPARATOR = ','
1210+THOUSAND_SEPARATOR = ' '
1211+NUMBER_GROUPING = 3
1212diff --git a/django/conf/locale/pl/__init__.py b/django/conf/locale/pl/__init__.py
1213new file mode 100644
1214index 0000000..e69de29
1215diff --git a/django/conf/locale/pl/formats.py b/django/conf/locale/pl/formats.py
1216new file mode 100644
1217index 0000000..860a4a8
1218--- /dev/null
1219+++ b/django/conf/locale/pl/formats.py
1220@@ -0,0 +1,18 @@
1221+# -*- encoding: utf-8 -*-
1222+# This file is distributed under the same license as the Django package.
1223+#
1224+
1225+DATE_FORMAT = 'j F Y'
1226+TIME_FORMAT = 'H:i:s'
1227+# DATETIME_FORMAT =
1228+YEAR_MONTH_FORMAT = 'F Y'
1229+MONTH_DAY_FORMAT = 'j F'
1230+SHORT_DATE_FORMAT = 'd-m-Y'
1231+# SHORT_DATETIME_FORMAT =
1232+# FIRST_DAY_OF_WEEK =
1233+# DATE_INPUT_FORMATS =
1234+# TIME_INPUT_FORMATS =
1235+# DATETIME_INPUT_FORMATS =
1236+DECIMAL_SEPARATOR = ','
1237+THOUSAND_SEPARATOR = ' '
1238+# NUMBER_GROUPING =
1239diff --git a/django/conf/locale/pt/__init__.py b/django/conf/locale/pt/__init__.py
1240new file mode 100644
1241index 0000000..e69de29
1242diff --git a/django/conf/locale/pt/formats.py b/django/conf/locale/pt/formats.py
1243new file mode 100644
1244index 0000000..053a48a
1245--- /dev/null
1246+++ b/django/conf/locale/pt/formats.py
1247@@ -0,0 +1,18 @@
1248+# -*- encoding: utf-8 -*-
1249+# This file is distributed under the same license as the Django package.
1250+#
1251+
1252+DATE_FORMAT = 'j \de F \de Y'
1253+TIME_FORMAT = 'H:i:s'
1254+# DATETIME_FORMAT =
1255+YEAR_MONTH_FORMAT = 'F \de Y'
1256+MONTH_DAY_FORMAT = 'j \de F'
1257+SHORT_DATE_FORMAT = 'd/m/Y'
1258+# SHORT_DATETIME_FORMAT =
1259+# FIRST_DAY_OF_WEEK =
1260+# DATE_INPUT_FORMATS =
1261+# TIME_INPUT_FORMATS =
1262+# DATETIME_INPUT_FORMATS =
1263+DECIMAL_SEPARATOR = ','
1264+THOUSAND_SEPARATOR = '.'
1265+# NUMBER_GROUPING =
1266diff --git a/django/conf/locale/pt_BR/__init__.py b/django/conf/locale/pt_BR/__init__.py
1267new file mode 100644
1268index 0000000..e69de29
1269diff --git a/django/conf/locale/pt_BR/formats.py b/django/conf/locale/pt_BR/formats.py
1270new file mode 100644
1271index 0000000..f30d5c4
1272--- /dev/null
1273+++ b/django/conf/locale/pt_BR/formats.py
1274@@ -0,0 +1,35 @@
1275+# -*- encoding: utf-8 -*-
1276+# This file is distributed under the same license as the Django package.
1277+#
1278+
1279+DATE_FORMAT = 'j \\de N \\de Y'
1280+TIME_FORMAT = 'H:i'
1281+DATETIME_FORMAT = 'j \\de N \\de Y à\\s H:i'
1282+YEAR_MONTH_FORMAT = 'F \\de Y'
1283+MONTH_DAY_FORMAT = 'j \\de F'
1284+SHORT_DATE_FORMAT = 'd/m/Y'
1285+SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
1286+FIRST_DAY_OF_WEEK = 0  # Sunday
1287+DATE_INPUT_FORMATS = (
1288+    '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
1289+    '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
1290+    '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
1291+)
1292+TIME_INPUT_FORMATS = (
1293+    '%H:%M:%S',     # '14:30:59'
1294+    '%H:%M',        # '14:30'
1295+)
1296+DATETIME_INPUT_FORMATS = (
1297+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
1298+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
1299+    '%Y-%m-%d',              # '2006-10-25'
1300+    '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
1301+    '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
1302+    '%d/%m/%Y',              # '25/10/2006'
1303+    '%d/%m/%y %H:%M:%S',     # '25/10/06 14:30:59'
1304+    '%d/%m/%y %H:%M',        # '25/10/06 14:30'
1305+    '%d/%m/%y',              # '25/10/06'
1306+)
1307+DECIMAL_SEPARATOR = ','
1308+THOUSAND_SEPARATOR = '.'
1309+NUMBER_GROUPING = 3
1310diff --git a/django/conf/locale/ro/__init__.py b/django/conf/locale/ro/__init__.py
1311new file mode 100644
1312index 0000000..e69de29
1313diff --git a/django/conf/locale/ro/formats.py b/django/conf/locale/ro/formats.py
1314new file mode 100644
1315index 0000000..6d6e800
1316--- /dev/null
1317+++ b/django/conf/locale/ro/formats.py
1318@@ -0,0 +1,18 @@
1319+# -*- encoding: utf-8 -*-
1320+# This file is distributed under the same license as the Django package.
1321+#
1322+
1323+DATE_FORMAT = 'j F Y'
1324+TIME_FORMAT = 'H:i:s'
1325+DATETIME_FORMAT = 'j F Y, H:i:s'
1326+YEAR_MONTH_FORMAT = 'F Y'
1327+MONTH_DAY_FORMAT = 'j F'
1328+SHORT_DATE_FORMAT = 'd.m.Y'
1329+SHORT_DATETIME_FORMAT = 'd.m.Y, H:i:s'
1330+# FIRST_DAY_OF_WEEK =
1331+# DATE_INPUT_FORMATS =
1332+# TIME_INPUT_FORMATS =
1333+# DATETIME_INPUT_FORMATS =
1334+DECIMAL_SEPARATOR = ','
1335+THOUSAND_SEPARATOR = '.'
1336+# NUMBER_GROUPING =
1337diff --git a/django/conf/locale/ru/__init__.py b/django/conf/locale/ru/__init__.py
1338new file mode 100644
1339index 0000000..e69de29
1340diff --git a/django/conf/locale/ru/formats.py b/django/conf/locale/ru/formats.py
1341new file mode 100644
1342index 0000000..9a9ee96
1343--- /dev/null
1344+++ b/django/conf/locale/ru/formats.py
1345@@ -0,0 +1,18 @@
1346+# -*- encoding: utf-8 -*-
1347+# This file is distributed under the same license as the Django package.
1348+#
1349+
1350+DATE_FORMAT = 'j F Y г.'
1351+TIME_FORMAT = 'G:i:s'
1352+# DATETIME_FORMAT =
1353+YEAR_MONTH_FORMAT = 'F Y'
1354+MONTH_DAY_FORMAT = 'j F'
1355+SHORT_DATE_FORMAT = 'd.m.Y'
1356+# SHORT_DATETIME_FORMAT =
1357+# FIRST_DAY_OF_WEEK =
1358+# DATE_INPUT_FORMATS =
1359+# TIME_INPUT_FORMATS =
1360+# DATETIME_INPUT_FORMATS =
1361+DECIMAL_SEPARATOR = ','
1362+THOUSAND_SEPARATOR = ' '
1363+# NUMBER_GROUPING =
1364diff --git a/django/conf/locale/sk/__init__.py b/django/conf/locale/sk/__init__.py
1365new file mode 100644
1366index 0000000..e69de29
1367diff --git a/django/conf/locale/sk/formats.py b/django/conf/locale/sk/formats.py
1368new file mode 100644
1369index 0000000..1bc3549
1370--- /dev/null
1371+++ b/django/conf/locale/sk/formats.py
1372@@ -0,0 +1,18 @@
1373+# -*- encoding: utf-8 -*-
1374+# This file is distributed under the same license as the Django package.
1375+#
1376+
1377+DATE_FORMAT = 'j. F Y'
1378+TIME_FORMAT = 'G:i:s'
1379+# DATETIME_FORMAT =
1380+YEAR_MONTH_FORMAT = 'F Y'
1381+MONTH_DAY_FORMAT = 'j. F'
1382+SHORT_DATE_FORMAT = 'j.n.Y'
1383+# SHORT_DATETIME_FORMAT =
1384+# FIRST_DAY_OF_WEEK =
1385+# DATE_INPUT_FORMATS =
1386+# TIME_INPUT_FORMATS =
1387+# DATETIME_INPUT_FORMATS =
1388+DECIMAL_SEPARATOR = ','
1389+THOUSAND_SEPARATOR = ' '
1390+# NUMBER_GROUPING =
1391diff --git a/django/conf/locale/sl/__init__.py b/django/conf/locale/sl/__init__.py
1392new file mode 100644
1393index 0000000..e69de29
1394diff --git a/django/conf/locale/sl/formats.py b/django/conf/locale/sl/formats.py
1395new file mode 100644
1396index 0000000..4007f10
1397--- /dev/null
1398+++ b/django/conf/locale/sl/formats.py
1399@@ -0,0 +1,18 @@
1400+# -*- encoding: utf-8 -*-
1401+# This file is distributed under the same license as the Django package.
1402+#
1403+
1404+DATE_FORMAT = 'd. F Y'
1405+TIME_FORMAT = 'H:i:s'
1406+# DATETIME_FORMAT =
1407+# YEAR_MONTH_FORMAT =
1408+MONTH_DAY_FORMAT = 'j. F'
1409+SHORT_DATE_FORMAT = 'j. M. Y'
1410+# SHORT_DATETIME_FORMAT =
1411+# FIRST_DAY_OF_WEEK =
1412+# DATE_INPUT_FORMATS =
1413+# TIME_INPUT_FORMATS =
1414+# DATETIME_INPUT_FORMATS =
1415+DECIMAL_SEPARATOR = ','
1416+THOUSAND_SEPARATOR = '.'
1417+# NUMBER_GROUPING =
1418diff --git a/django/conf/locale/sr/__init__.py b/django/conf/locale/sr/__init__.py
1419new file mode 100644
1420index 0000000..e69de29
1421diff --git a/django/conf/locale/sr/formats.py b/django/conf/locale/sr/formats.py
1422new file mode 100644
1423index 0000000..6dc19cf
1424--- /dev/null
1425+++ b/django/conf/locale/sr/formats.py
1426@@ -0,0 +1,44 @@
1427+# -*- encoding: utf-8 -*-
1428+# This file is distributed under the same license as the Django package.
1429+#
1430+
1431+DATE_FORMAT = 'j. F Y.'
1432+TIME_FORMAT = 'H:i'
1433+DATETIME_FORMAT = 'j. F Y. H:i'
1434+YEAR_MONTH_FORMAT = 'F Y.'
1435+MONTH_DAY_FORMAT = 'j. F'
1436+SHORT_DATE_FORMAT = 'j.m.Y.'
1437+SHORT_DATETIME_FORMAT = 'j.m.Y. H:i'
1438+FIRST_DAY_OF_WEEK = 1
1439+DATE_INPUT_FORMATS = (
1440+    '%Y-%m-%d',                     # '2006-10-25'
1441+    '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
1442+    '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
1443+    '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
1444+    '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
1445+    '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
1446+)
1447+TIME_INPUT_FORMATS = (
1448+    '%H:%M:%S',     # '14:30:59'
1449+    '%H:%M',        # '14:30'
1450+)
1451+DATETIME_INPUT_FORMATS = (
1452+    '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
1453+    '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
1454+    '%Y-%m-%d',               # '2006-10-25'
1455+    '%d.%m.%Y. %H:%M:%S',     # '25.10.2006. 14:30:59'
1456+    '%d.%m.%Y. %H:%M',        # '25.10.2006. 14:30'
1457+    '%d.%m.%Y.',              # '25.10.2006.'
1458+    '%d.%m.%y. %H:%M:%S',     # '25.10.06. 14:30:59'
1459+    '%d.%m.%y. %H:%M',        # '25.10.06. 14:30'
1460+    '%d.%m.%y.',              # '25.10.06.'
1461+    '%d. %m. %Y. %H:%M:%S',   # '25. 10. 2006. 14:30:59'
1462+    '%d. %m. %Y. %H:%M',      # '25. 10. 2006. 14:30'
1463+    '%d. %m. %Y.',            # '25. 10. 2006.'
1464+    '%d. %m. %y. %H:%M:%S',   # '25. 10. 06. 14:30:59'
1465+    '%d. %m. %y. %H:%M',      # '25. 10. 06. 14:30'
1466+    '%d. %m. %y.',            # '25. 10. 06.'
1467+)
1468+DECIMAL_SEPARATOR = '.'
1469+THOUSAND_SEPARATOR = ','
1470+NUMBER_GROUPING = 3
1471diff --git a/django/conf/locale/sr_Latn/__init__.py b/django/conf/locale/sr_Latn/__init__.py
1472new file mode 100644
1473index 0000000..e69de29
1474diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py
1475new file mode 100644
1476index 0000000..6dc19cf
1477--- /dev/null
1478+++ b/django/conf/locale/sr_Latn/formats.py
1479@@ -0,0 +1,44 @@
1480+# -*- encoding: utf-8 -*-
1481+# This file is distributed under the same license as the Django package.
1482+#
1483+
1484+DATE_FORMAT = 'j. F Y.'
1485+TIME_FORMAT = 'H:i'
1486+DATETIME_FORMAT = 'j. F Y. H:i'
1487+YEAR_MONTH_FORMAT = 'F Y.'
1488+MONTH_DAY_FORMAT = 'j. F'
1489+SHORT_DATE_FORMAT = 'j.m.Y.'
1490+SHORT_DATETIME_FORMAT = 'j.m.Y. H:i'
1491+FIRST_DAY_OF_WEEK = 1
1492+DATE_INPUT_FORMATS = (
1493+    '%Y-%m-%d',                     # '2006-10-25'
1494+    '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
1495+    '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
1496+    '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
1497+    '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
1498+    '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
1499+)
1500+TIME_INPUT_FORMATS = (
1501+    '%H:%M:%S',     # '14:30:59'
1502+    '%H:%M',        # '14:30'
1503+)
1504+DATETIME_INPUT_FORMATS = (
1505+    '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
1506+    '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
1507+    '%Y-%m-%d',               # '2006-10-25'
1508+    '%d.%m.%Y. %H:%M:%S',     # '25.10.2006. 14:30:59'
1509+    '%d.%m.%Y. %H:%M',        # '25.10.2006. 14:30'
1510+    '%d.%m.%Y.',              # '25.10.2006.'
1511+    '%d.%m.%y. %H:%M:%S',     # '25.10.06. 14:30:59'
1512+    '%d.%m.%y. %H:%M',        # '25.10.06. 14:30'
1513+    '%d.%m.%y.',              # '25.10.06.'
1514+    '%d. %m. %Y. %H:%M:%S',   # '25. 10. 2006. 14:30:59'
1515+    '%d. %m. %Y. %H:%M',      # '25. 10. 2006. 14:30'
1516+    '%d. %m. %Y.',            # '25. 10. 2006.'
1517+    '%d. %m. %y. %H:%M:%S',   # '25. 10. 06. 14:30:59'
1518+    '%d. %m. %y. %H:%M',      # '25. 10. 06. 14:30'
1519+    '%d. %m. %y.',            # '25. 10. 06.'
1520+)
1521+DECIMAL_SEPARATOR = '.'
1522+THOUSAND_SEPARATOR = ','
1523+NUMBER_GROUPING = 3
1524diff --git a/django/conf/locale/sv/__init__.py b/django/conf/locale/sv/__init__.py
1525new file mode 100644
1526index 0000000..e69de29
1527diff --git a/django/conf/locale/sv/formats.py b/django/conf/locale/sv/formats.py
1528new file mode 100644
1529index 0000000..df4e633
1530--- /dev/null
1531+++ b/django/conf/locale/sv/formats.py
1532@@ -0,0 +1,18 @@
1533+# -*- encoding: utf-8 -*-
1534+# This file is distributed under the same license as the Django package.
1535+#
1536+
1537+DATE_FORMAT = 'j F Y'
1538+TIME_FORMAT = 'H.i.s'
1539+# DATETIME_FORMAT =
1540+YEAR_MONTH_FORMAT = 'Y F'
1541+MONTH_DAY_FORMAT = 'j F'
1542+SHORT_DATE_FORMAT = 'j M Y'
1543+# SHORT_DATETIME_FORMAT =
1544+# FIRST_DAY_OF_WEEK =
1545+# DATE_INPUT_FORMATS =
1546+# TIME_INPUT_FORMATS =
1547+# DATETIME_INPUT_FORMATS =
1548+DECIMAL_SEPARATOR = ','
1549+THOUSAND_SEPARATOR = ' '
1550+# NUMBER_GROUPING =
1551diff --git a/django/conf/locale/ta/__init__.py b/django/conf/locale/ta/__init__.py
1552new file mode 100644
1553index 0000000..e69de29
1554diff --git a/django/conf/locale/ta/formats.py b/django/conf/locale/ta/formats.py
1555new file mode 100644
1556index 0000000..69fa17d
1557--- /dev/null
1558+++ b/django/conf/locale/ta/formats.py
1559@@ -0,0 +1,18 @@
1560+# -*- encoding: utf-8 -*-
1561+# This file is distributed under the same license as the Django package.
1562+#
1563+
1564+DATE_FORMAT = 'j F, Y'
1565+TIME_FORMAT = 'g:i:s A'
1566+# DATETIME_FORMAT =
1567+# YEAR_MONTH_FORMAT =
1568+MONTH_DAY_FORMAT = 'j F'
1569+SHORT_DATE_FORMAT = 'j M, Y'
1570+# SHORT_DATETIME_FORMAT =
1571+# FIRST_DAY_OF_WEEK =
1572+# DATE_INPUT_FORMATS =
1573+# TIME_INPUT_FORMATS =
1574+# DATETIME_INPUT_FORMATS =
1575+# DECIMAL_SEPARATOR =
1576+# THOUSAND_SEPARATOR =
1577+# NUMBER_GROUPING =
1578diff --git a/django/conf/locale/te/__init__.py b/django/conf/locale/te/__init__.py
1579new file mode 100644
1580index 0000000..e69de29
1581diff --git a/django/conf/locale/te/formats.py b/django/conf/locale/te/formats.py
1582new file mode 100644
1583index 0000000..e805872
1584--- /dev/null
1585+++ b/django/conf/locale/te/formats.py
1586@@ -0,0 +1,18 @@
1587+# -*- encoding: utf-8 -*-
1588+# This file is distributed under the same license as the Django package.
1589+#
1590+
1591+DATE_FORMAT = 'j F Y'
1592+TIME_FORMAT = 'g:i:s A'
1593+# DATETIME_FORMAT =
1594+# YEAR_MONTH_FORMAT =
1595+MONTH_DAY_FORMAT = 'j F'
1596+SHORT_DATE_FORMAT = 'j M Y'
1597+# SHORT_DATETIME_FORMAT =
1598+# FIRST_DAY_OF_WEEK =
1599+# DATE_INPUT_FORMATS =
1600+# TIME_INPUT_FORMATS =
1601+# DATETIME_INPUT_FORMATS =
1602+# DECIMAL_SEPARATOR =
1603+# THOUSAND_SEPARATOR =
1604+# NUMBER_GROUPING =
1605diff --git a/django/conf/locale/th/__init__.py b/django/conf/locale/th/__init__.py
1606new file mode 100644
1607index 0000000..e69de29
1608diff --git a/django/conf/locale/th/formats.py b/django/conf/locale/th/formats.py
1609new file mode 100644
1610index 0000000..7091dc6
1611--- /dev/null
1612+++ b/django/conf/locale/th/formats.py
1613@@ -0,0 +1,18 @@
1614+# -*- encoding: utf-8 -*-
1615+# This file is distributed under the same license as the Django package.
1616+#
1617+
1618+DATE_FORMAT = 'j F Y'
1619+TIME_FORMAT = 'G:i:s'
1620+DATETIME_FORMAT = 'j F Y, G:i:s'
1621+YEAR_MONTH_FORMAT = 'F Y'
1622+MONTH_DAY_FORMAT = 'j F'
1623+SHORT_DATE_FORMAT = 'j M Y'
1624+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
1625+# FIRST_DAY_OF_WEEK =
1626+# DATE_INPUT_FORMATS =
1627+# TIME_INPUT_FORMATS =
1628+# DATETIME_INPUT_FORMATS =
1629+DECIMAL_SEPARATOR = '.'
1630+THOUSAND_SEPARATOR = ','
1631+# NUMBER_GROUPING =
1632diff --git a/django/conf/locale/tr/__init__.py b/django/conf/locale/tr/__init__.py
1633new file mode 100644
1634index 0000000..e69de29
1635diff --git a/django/conf/locale/tr/formats.py b/django/conf/locale/tr/formats.py
1636new file mode 100644
1637index 0000000..b978788
1638--- /dev/null
1639+++ b/django/conf/locale/tr/formats.py
1640@@ -0,0 +1,18 @@
1641+# -*- encoding: utf-8 -*-
1642+# This file is distributed under the same license as the Django package.
1643+#
1644+
1645+DATE_FORMAT = 'd F Y'
1646+TIME_FORMAT = 'H:i:s'
1647+# DATETIME_FORMAT =
1648+YEAR_MONTH_FORMAT = 'F Y'
1649+MONTH_DAY_FORMAT = 'd F'
1650+SHORT_DATE_FORMAT = 'd M Y'
1651+# SHORT_DATETIME_FORMAT =
1652+# FIRST_DAY_OF_WEEK =
1653+# DATE_INPUT_FORMATS =
1654+# TIME_INPUT_FORMATS =
1655+# DATETIME_INPUT_FORMATS =
1656+DECIMAL_SEPARATOR = ','
1657+THOUSAND_SEPARATOR = '.'
1658+# NUMBER_GROUPING =
1659diff --git a/django/conf/locale/uk/__init__.py b/django/conf/locale/uk/__init__.py
1660new file mode 100644
1661index 0000000..e69de29
1662diff --git a/django/conf/locale/uk/formats.py b/django/conf/locale/uk/formats.py
1663new file mode 100644
1664index 0000000..8e41bf0
1665--- /dev/null
1666+++ b/django/conf/locale/uk/formats.py
1667@@ -0,0 +1,18 @@
1668+# -*- encoding: utf-8 -*-
1669+# This file is distributed under the same license as the Django package.
1670+#
1671+
1672+DATE_FORMAT = 'j F Y р.'
1673+TIME_FORMAT = 'H:i:s'
1674+# DATETIME_FORMAT =
1675+YEAR_MONTH_FORMAT = 'F Y'
1676+MONTH_DAY_FORMAT = 'j F'
1677+SHORT_DATE_FORMAT = 'j M Y'
1678+# SHORT_DATETIME_FORMAT =
1679+# FIRST_DAY_OF_WEEK =
1680+# DATE_INPUT_FORMATS =
1681+# TIME_INPUT_FORMATS =
1682+# DATETIME_INPUT_FORMATS =
1683+DECIMAL_SEPARATOR = ','
1684+THOUSAND_SEPARATOR = ' '
1685+# NUMBER_GROUPING =
1686diff --git a/django/conf/locale/zh_CN/__init__.py b/django/conf/locale/zh_CN/__init__.py
1687new file mode 100644
1688index 0000000..e69de29
1689diff --git a/django/conf/locale/zh_CN/formats.py b/django/conf/locale/zh_CN/formats.py
1690new file mode 100644
1691index 0000000..6d71786
1692--- /dev/null
1693+++ b/django/conf/locale/zh_CN/formats.py
1694@@ -0,0 +1,18 @@
1695+# -*- encoding: utf-8 -*-
1696+# This file is distributed under the same license as the Django package.
1697+#
1698+
1699+# DATE_FORMAT =
1700+# TIME_FORMAT =
1701+# DATETIME_FORMAT =
1702+# YEAR_MONTH_FORMAT =
1703+# MONTH_DAY_FORMAT =
1704+# SHORT_DATE_FORMAT =
1705+# SHORT_DATETIME_FORMAT =
1706+# FIRST_DAY_OF_WEEK =
1707+# DATE_INPUT_FORMATS =
1708+# TIME_INPUT_FORMATS =
1709+# DATETIME_INPUT_FORMATS =
1710+# DECIMAL_SEPARATOR =
1711+# THOUSAND_SEPARATOR =
1712+# NUMBER_GROUPING =
1713diff --git a/django/conf/locale/zh_TW/__init__.py b/django/conf/locale/zh_TW/__init__.py
1714new file mode 100644
1715index 0000000..e69de29
1716diff --git a/django/conf/locale/zh_TW/formats.py b/django/conf/locale/zh_TW/formats.py
1717new file mode 100644
1718index 0000000..6d71786
1719--- /dev/null
1720+++ b/django/conf/locale/zh_TW/formats.py
1721@@ -0,0 +1,18 @@
1722+# -*- encoding: utf-8 -*-
1723+# This file is distributed under the same license as the Django package.
1724+#
1725+
1726+# DATE_FORMAT =
1727+# TIME_FORMAT =
1728+# DATETIME_FORMAT =
1729+# YEAR_MONTH_FORMAT =
1730+# MONTH_DAY_FORMAT =
1731+# SHORT_DATE_FORMAT =
1732+# SHORT_DATETIME_FORMAT =
1733+# FIRST_DAY_OF_WEEK =
1734+# DATE_INPUT_FORMATS =
1735+# TIME_INPUT_FORMATS =
1736+# DATETIME_INPUT_FORMATS =
1737+# DECIMAL_SEPARATOR =
1738+# THOUSAND_SEPARATOR =
1739+# NUMBER_GROUPING =
1740diff --git a/django/contrib/admin/media/js/calendar.js b/django/contrib/admin/media/js/calendar.js
1741index 9035176..3f57145 100644
1742--- a/django/contrib/admin/media/js/calendar.js
1743+++ b/django/contrib/admin/media/js/calendar.js
1744@@ -25,6 +25,7 @@ function quickElement() {
1745 var CalendarNamespace = {
1746     monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
1747     daysOfWeek: gettext('S M T W T F S').split(' '),
1748+    firstDayOfWeek: parseInt(gettext('FIRST_DAY_OF_WEEK')),
1749     isLeapYear: function(year) {
1750         return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
1751     },
1752@@ -56,10 +57,10 @@ var CalendarNamespace = {
1753         // Draw days-of-week header
1754         var tableRow = quickElement('tr', tableBody);
1755         for (var i = 0; i < 7; i++) {
1756-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]);
1757+            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
1758         }
1759 
1760-        var startingPos = new Date(year, month-1, 1).getDay();
1761+        var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
1762         var days = CalendarNamespace.getDaysInMonth(month, year);
1763 
1764         // Draw blanks before first of month
1765diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
1766index 38b1c34..9e6223a 100644
1767--- a/django/contrib/admin/templates/admin/object_history.html
1768+++ b/django/contrib/admin/templates/admin/object_history.html
1769@@ -27,7 +27,7 @@
1770         <tbody>
1771         {% for action in action_list %}
1772         <tr>
1773-            <th scope="row">{{ action.action_time|date:_("DATETIME_FORMAT") }}</th>
1774+            <th scope="row">{{ action.action_time|date }}</th>
1775             <td>{{ action.user.username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}</td>
1776             <td>{{ action.change_message }}</td>
1777         </tr>
1778diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
1779index 5a02ab0..cd05957 100644
1780--- a/django/contrib/admin/templatetags/admin_list.py
1781+++ b/django/contrib/admin/templatetags/admin_list.py
1782@@ -3,11 +3,11 @@ from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
1783 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
1784 from django.core.exceptions import ObjectDoesNotExist
1785 from django.db import models
1786-from django.utils import dateformat
1787+from django.utils import formats
1788 from django.utils.html import escape, conditional_escape
1789 from django.utils.text import capfirst
1790 from django.utils.safestring import mark_safe
1791-from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
1792+from django.utils.translation import ugettext as _
1793 from django.utils.encoding import smart_unicode, smart_str, force_unicode
1794 from django.template import Library
1795 import datetime
1796@@ -189,25 +189,24 @@ def items_for_result(cl, result, form):
1797             # Dates and times are special: They're formatted in a certain way.
1798             elif isinstance(f, models.DateField) or isinstance(f, models.TimeField):
1799                 if field_val:
1800-                    (date_format, datetime_format, time_format) = get_date_formats()
1801-                    if isinstance(f, models.DateTimeField):
1802-                        result_repr = capfirst(dateformat.format(field_val, datetime_format))
1803-                    elif isinstance(f, models.TimeField):
1804-                        result_repr = capfirst(dateformat.time_format(field_val, time_format))
1805-                    else:
1806-                        result_repr = capfirst(dateformat.format(field_val, date_format))
1807+                    result_repr = formats.localize(field_val)
1808+                else:
1809+                    result_repr = EMPTY_CHANGELIST_VALUE
1810+            elif isinstance(f, models.DecimalField):
1811+                if field_val:
1812+                    result_repr = formats.number_format(field_val, f.decimal_places)
1813+                else:
1814+                    result_repr = EMPTY_CHANGELIST_VALUE
1815+                row_class = ' class="nowrap"'
1816+            elif isinstance(f, models.FloatField):
1817+                if field_val:
1818+                    result_repr = formats.number_format(field_val)
1819                 else:
1820                     result_repr = EMPTY_CHANGELIST_VALUE
1821                 row_class = ' class="nowrap"'
1822             # Booleans are special: We use images.
1823             elif isinstance(f, models.BooleanField) or isinstance(f, models.NullBooleanField):
1824                 result_repr = _boolean_icon(field_val)
1825-            # DecimalFields are special: Zero-pad the decimals.
1826-            elif isinstance(f, models.DecimalField):
1827-                if field_val is not None:
1828-                    result_repr = ('%%.%sf' % f.decimal_places) % field_val
1829-                else:
1830-                    result_repr = EMPTY_CHANGELIST_VALUE
1831             # Fields with choices are special: Use the representation
1832             # of the choice.
1833             elif f.flatchoices:
1834@@ -268,7 +267,6 @@ def date_hierarchy(cl):
1835         year_lookup = cl.params.get(year_field)
1836         month_lookup = cl.params.get(month_field)
1837         day_lookup = cl.params.get(day_field)
1838-        year_month_format, month_day_format = get_partial_date_formats()
1839 
1840         link = lambda d: cl.get_query_string(d, [field_generic])
1841 
1842@@ -278,9 +276,9 @@ def date_hierarchy(cl):
1843                 'show': True,
1844                 'back': {
1845                     'link': link({year_field: year_lookup, month_field: month_lookup}),
1846-                    'title': dateformat.format(day, year_month_format)
1847+                    'title': capfirst(formats.date_format(day, 'YEAR_MONTH_FORMAT'))
1848                 },
1849-                'choices': [{'title': dateformat.format(day, month_day_format)}]
1850+                'choices': [{'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))}]
1851             }
1852         elif year_lookup and month_lookup:
1853             days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')
1854@@ -292,7 +290,7 @@ def date_hierarchy(cl):
1855                 },
1856                 'choices': [{
1857                     'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),
1858-                    'title': dateformat.format(day, month_day_format)
1859+                    'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))
1860                 } for day in days]
1861             }
1862         elif year_lookup:
1863@@ -305,7 +303,7 @@ def date_hierarchy(cl):
1864                 },
1865                 'choices': [{
1866                     'link': link({year_field: year_lookup, month_field: month.month}),
1867-                    'title': dateformat.format(month, year_month_format)
1868+                    'title': capfirst(formats.date_format(month, 'YEAR_MONTH_FORMAT'))
1869                 } for month in months]
1870             }
1871         else:
1872diff --git a/django/contrib/databrowse/datastructures.py b/django/contrib/databrowse/datastructures.py
1873index 5fdbdbe..369f825 100644
1874--- a/django/contrib/databrowse/datastructures.py
1875+++ b/django/contrib/databrowse/datastructures.py
1876@@ -4,9 +4,8 @@ convenience functionality and permalink functions for the databrowse app.
1877 """
1878 
1879 from django.db import models
1880-from django.utils import dateformat
1881+from django.utils import formats
1882 from django.utils.text import capfirst
1883-from django.utils.translation import get_date_formats
1884 from django.utils.encoding import smart_unicode, smart_str, iri_to_uri
1885 from django.utils.safestring import mark_safe
1886 from django.db.models.query import QuerySet
1887@@ -156,13 +155,12 @@ class EasyInstanceField(object):
1888             objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
1889         elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
1890             if self.raw_value:
1891-                date_format, datetime_format, time_format = get_date_formats()
1892                 if isinstance(self.field, models.DateTimeField):
1893-                    objs = capfirst(dateformat.format(self.raw_value, datetime_format))
1894+                    objs = capfirst(formats.date_format(self.raw_value, 'DATETIME_FORMAT'))
1895                 elif isinstance(self.field, models.TimeField):
1896-                    objs = capfirst(dateformat.time_format(self.raw_value, time_format))
1897+                    objs = capfirst(formats.date_format(self.raw_value, 'TIME_FORMAT'))
1898                 else:
1899-                    objs = capfirst(dateformat.format(self.raw_value, date_format))
1900+                    objs = capfirst(formats.date_format(self.raw_value, 'DATE_FORMAT'))
1901             else:
1902                 objs = EMPTY_VALUE
1903         elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
1904diff --git a/django/core/management/commands/importcldr.py b/django/core/management/commands/importcldr.py
1905new file mode 100644
1906index 0000000..c4a13e6
1907--- /dev/null
1908+++ b/django/core/management/commands/importcldr.py
1909@@ -0,0 +1,221 @@
1910+import sys
1911+import os
1912+import re
1913+from optparse import make_option, OptionParser
1914+
1915+from django.core.management.base import LabelCommand, CommandError
1916+
1917+try:
1918+    from lxml import etree
1919+except ImportError:
1920+    raise CommandError('You need to install `python-lxml` to run this script')
1921+
1922+FORMATS_FILE_NAME = 'formats.py'
1923+FORMATS_FILE_HEADER = '''# -*- encoding: utf-8 -*-
1924+# This file is distributed under the same license as the Django package.
1925+#
1926+
1927+'''
1928+
1929+def quote(nodes, name,  locale, previous):
1930+    if len(nodes):
1931+        return "'%s'" % unicode(nodes[0].text).replace("'", "\\'")
1932+    else:
1933+        return None
1934+
1935+def convert_time(nodes, name,  locale, previous):
1936+    SPECIAL_CHARS = ('a', 'A', 'b', 'B', 'd', 'D', 'f', 'F', 'g', 'G', 'h',
1937+        'H', 'i', 'I', 'j', 'l', 'L', 'm', 'M', 'n', 'N', 'O', 'P', 'r',
1938+        's', 'S', 't', 'T', 'U', 'w', 'W', 'y', 'Y', 'z', 'Z')
1939+    FORMAT_STR_MAP = ( # not using a dict, because we have to apply formats in order
1940+        ('dd', 'd'),
1941+        ('d', 'j'),
1942+        ('MMMM', 'F'),
1943+        ('MMM', 'M'),
1944+        ('MM', 'm'),
1945+        ('M', 'n'),
1946+        ('yyyy', 'Y'),
1947+        ('yy', 'y'),
1948+        ('y', 'Y'),
1949+        ('hh', 'h'),
1950+        ('h', 'g'),
1951+        ('HH', 'H'),
1952+        ('H', 'G'),
1953+        ('mm', 'i'),
1954+        ('ss', 's'),
1955+        ('a', 'A'),
1956+        ('LLLL', 'F'),
1957+    )
1958+    if len(nodes):
1959+        original = nodes[0].text
1960+        result = ''
1961+        for cnt, segment in enumerate(original.split("'")):
1962+            if cnt % 2:
1963+                for char in SPECIAL_CHARS:
1964+                    segment = segment.replace(char, '\\%s' % char)
1965+                result += segment
1966+            else:
1967+                while segment:
1968+                    found = False
1969+                    for src, dst in FORMAT_STR_MAP:
1970+                        if segment[0:len(src)] == src:
1971+                            result += dst
1972+                            segment = segment[len(src):]
1973+                            found = True
1974+                            break
1975+                    if not found:
1976+                        result += segment[0]
1977+                        segment = segment[1:]
1978+
1979+        return "'%s'" % result
1980+    else:
1981+        return None
1982+
1983+def datetime(nodes, name, locale, previous):
1984+    result = None
1985+    if len(nodes) and 'DATE_FORMAT' in previous and 'TIME_FORMAT' in previous:
1986+        result = nodes[0].text
1987+        result = result.replace('{0}', previous['TIME_FORMAT'][1:-1])
1988+        if name == 'SHORT_DATETIME_FORMAT' and 'SHORT_DATE_FORMAT' in previous:
1989+            result = result.replace('{1}', previous['SHORT_DATE_FORMAT'][1:-1])
1990+        else:
1991+            result = result.replace('{1}', previous['DATE_FORMAT'][1:-1])
1992+    if result:
1993+        return "'%s'" % result
1994+    else:
1995+        return None
1996+
1997+FORMATS_MAP = [
1998+    {
1999+        'name': 'DATE_FORMAT',
2000+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2001+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='long']/dateFormat/pattern",
2002+        'conversion': convert_time,
2003+    },
2004+    {
2005+        'name': 'TIME_FORMAT',
2006+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2007+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/timeFormats/timeFormatLength[@type='medium']/timeFormat/pattern",
2008+        'conversion': convert_time,
2009+    },
2010+    {
2011+        'name': 'DATETIME_FORMAT',
2012+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2013+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='long']/dateTimeFormat/pattern",
2014+        'conversion': datetime,
2015+    },
2016+    {
2017+        'name': 'YEAR_MONTH_FORMAT',
2018+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2019+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='yMMMM']",
2020+        'conversion': convert_time,
2021+    },
2022+    {
2023+        'name': 'MONTH_DAY_FORMAT',
2024+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2025+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='MMMMd']",
2026+        'conversion': convert_time,
2027+    },
2028+    {
2029+        'name': 'SHORT_DATE_FORMAT',
2030+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2031+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='medium']/dateFormat/pattern",
2032+        'conversion': convert_time,
2033+    },
2034+    {
2035+        'name': 'SHORT_DATETIME_FORMAT',
2036+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2037+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='short']/dateTimeFormat/pattern",
2038+        'conversion': datetime,
2039+    },
2040+    {'name': 'FIRST_DAY_OF_WEEK'},
2041+    {'name': 'DATE_INPUT_FORMATS'},
2042+    {'name': 'TIME_INPUT_FORMATS'},
2043+    {'name': 'DATETIME_INPUT_FORMATS'},
2044+    {
2045+        'name': 'DECIMAL_SEPARATOR',
2046+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2047+        'pattern': "/ldml/numbers/symbols/decimal",
2048+        'conversion': quote,
2049+    },
2050+    {
2051+        'name': 'THOUSAND_SEPARATOR',
2052+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2053+        'pattern': "/ldml/numbers/symbols/group",
2054+        'conversion': quote,
2055+    },
2056+    {'name': 'NUMBER_GROUPING'},
2057+]
2058+"""
2059+"""
2060+
2061+def get_locales(django_locale_dir, locale=None):
2062+    if locale:
2063+        yield locale
2064+    else:
2065+        locale_re = re.compile('[a-z]{2}(_[A-Z]{2})?')
2066+        for locale in os.listdir(django_locale_dir):
2067+            if locale_re.match(locale):
2068+                yield locale
2069+
2070+def import_cldr(cldr_dir, locale=None, overwrite=False):
2071+    """
2072+    For every locale defined in Django, get from the CLDR locale file all
2073+    settings defined in output_structure, and write the result to the
2074+    locale directories on Django.
2075+    """
2076+    if not os.path.isdir(cldr_dir):
2077+        raise Exception, "Specified CLDR directory '%s' does not exist" % cldr_dir
2078+
2079+    import django
2080+    django_locale_dir = os.path.join(os.path.dirname(django.__file__), 'conf', 'locale')
2081+
2082+    for locale in get_locales(django_locale_dir, locale):
2083+        output_filename = os.path.join(django_locale_dir, locale, FORMATS_FILE_NAME)
2084+        if os.path.isfile(output_filename) and not overwrite:
2085+            print "'%s' locale already exists. Skipping" % locale
2086+        else:
2087+            result = {}
2088+            output_file = open(output_filename, 'w')
2089+            output_file.write(FORMATS_FILE_HEADER)
2090+            for format in FORMATS_MAP:
2091+                if 'file' in format:
2092+                    cldr_file = os.path.join(cldr_dir, format['file'] % dict(locale=locale))
2093+                    tree = etree.parse(cldr_file) # TODO: error control
2094+                    try:
2095+                        original_value = tree.xpath(format['pattern'])
2096+                    except IndexError:
2097+                        output_file.write('# %s = \n' % (format['name']))
2098+                    else:
2099+                        value = format['conversion'](original_value, format['name'], locale, result)
2100+                        if value:
2101+                            output_file.write('%s = %s\n' % (format['name'], value.encode('utf8')))
2102+                            result[format['name']] = value
2103+                        else:
2104+                            output_file.write('# %s = \n' % (format['name']))
2105+                else:
2106+                    output_file.write('# %s = \n' % (format['name']))
2107+            output_file.close()
2108+
2109+            init_filename = os.path.join(django_locale_dir, locale, '__init__.py')
2110+            open(init_filename, 'a').close()
2111+
2112+class Command(LabelCommand):
2113+    option_list = LabelCommand.option_list + (
2114+        make_option('--locale', '-l', dest='locale',
2115+            help='The locale to process. Default is to process all.'),
2116+    ) + (
2117+        make_option('--overwite', '-o', action='store_true', dest='overwrite',
2118+            help='Wheter to overwrite format definitions of locales that already have one.'),
2119+    )
2120+    help = 'Creates format definition files for locales, importing data from the CLDR.'
2121+    args = '[cldrpath]'
2122+    label = 'CLDR path'
2123+    requires_model_validation = False
2124+    can_import_settings = False
2125+
2126+    def handle_label(self, cldrpath, **options):
2127+        locale = options.get('locale')
2128+        overwrite = options.get('overwrite')
2129+        import_cldr(cldrpath, locale, overwrite)
2130+
2131diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
2132index e36b8a1..04ad24d 100644
2133--- a/django/forms/extras/widgets.py
2134+++ b/django/forms/extras/widgets.py
2135@@ -8,6 +8,8 @@ import re
2136 from django.forms.widgets import Widget, Select
2137 from django.utils.dates import MONTHS
2138 from django.utils.safestring import mark_safe
2139+from django.utils.formats import getformat
2140+from django.conf import settings
2141 
2142 __all__ = ('SelectDateWidget',)
2143 
2144@@ -45,38 +47,27 @@ class SelectDateWidget(Widget):
2145                 if match:
2146                     year_val, month_val, day_val = [int(v) for v in match.groups()]
2147 
2148-        output = []
2149-
2150-        if 'id' in self.attrs:
2151-            id_ = self.attrs['id']
2152-        else:
2153-            id_ = 'id_%s' % name
2154-
2155-        month_choices = MONTHS.items()
2156-        if not (self.required and value):
2157-            month_choices.append(self.none_value)
2158-        month_choices.sort()
2159-        local_attrs = self.build_attrs(id=self.month_field % id_)
2160-        s = Select(choices=month_choices)
2161-        select_html = s.render(self.month_field % name, month_val, local_attrs)
2162-        output.append(select_html)
2163-
2164-        day_choices = [(i, i) for i in range(1, 32)]
2165-        if not (self.required and value):
2166-            day_choices.insert(0, self.none_value)
2167-        local_attrs['id'] = self.day_field % id_
2168-        s = Select(choices=day_choices)
2169-        select_html = s.render(self.day_field % name, day_val, local_attrs)
2170-        output.append(select_html)
2171-
2172-        year_choices = [(i, i) for i in self.years]
2173-        if not (self.required and value):
2174-            year_choices.insert(0, self.none_value)
2175-        local_attrs['id'] = self.year_field % id_
2176-        s = Select(choices=year_choices)
2177-        select_html = s.render(self.year_field % name, year_val, local_attrs)
2178-        output.append(select_html)
2179+        choices = [(i, i) for i in self.years]
2180+        year_html = self.create_select(name, self.year_field, value, year_val, choices)
2181+        choices = MONTHS.items()
2182+        month_html = self.create_select(name, self.month_field, value, month_val, choices)
2183+        choices = [(i, i) for i in range(1, 32)]
2184+        day_html = self.create_select(name, self.day_field, value, day_val,  choices)
2185 
2186+        format = getformat('DATE_FORMAT')
2187+        escaped = False
2188+        output = []
2189+        for char in format:
2190+            if escaped:
2191+                escaped = False
2192+            elif char == '\\':
2193+                escaped = True
2194+            elif char in 'Yy':
2195+                output.append(year_html)
2196+            elif char in 'bFMmNn':
2197+                output.append(month_html)
2198+            elif char in 'dj':
2199+                output.append(day_html)
2200         return mark_safe(u'\n'.join(output))
2201 
2202     def id_for_label(self, id_):
2203@@ -90,5 +81,27 @@ class SelectDateWidget(Widget):
2204         if y == m == d == "0":
2205             return None
2206         if y and m and d:
2207-            return '%s-%s-%s' % (y, m, d)
2208+            if settings.USE_FORMAT_I18N:
2209+                input_format = getformat('DATE_INPUT_FORMATS')[0]
2210+                try:
2211+                    date_value = datetime.date(int(y), int(m), int(d))
2212+                except ValueError:
2213+                    pass
2214+                else:
2215+                    return date_value.strftime(input_format)
2216+            else:
2217+                return '%s-%s-%s' % (y, m, d)
2218         return data.get(name, None)
2219+
2220+    def create_select(self, name, field, value, val, choices):
2221+        if 'id' in self.attrs:
2222+            id_ = self.attrs['id']
2223+        else:
2224+            id_ = 'id_%s' % name
2225+        if not (self.required and value):
2226+            choices.insert(0, self.none_value)
2227+        local_attrs = self.build_attrs(id=field % id_)
2228+        s = Select(choices=choices)
2229+        select_html = s.render(field % name, val, local_attrs)
2230+        return select_html
2231+
2232diff --git a/django/forms/fields.py b/django/forms/fields.py
2233index c0ee2f0..6009096 100644
2234--- a/django/forms/fields.py
2235+++ b/django/forms/fields.py
2236@@ -17,15 +17,14 @@ import django.core.exceptions
2237 import django.utils.copycompat as copy
2238 from django.utils.translation import ugettext_lazy as _
2239 from django.utils.encoding import smart_unicode, smart_str
2240+from django.utils.formats import getformat
2241 
2242 from util import ErrorList, ValidationError
2243 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
2244 
2245 __all__ = (
2246     'Field', 'CharField', 'IntegerField',
2247-    'DEFAULT_DATE_INPUT_FORMATS', 'DateField',
2248-    'DEFAULT_TIME_INPUT_FORMATS', 'TimeField',
2249-    'DEFAULT_DATETIME_INPUT_FORMATS', 'DateTimeField', 'TimeField',
2250+    'DateField', 'TimeField', 'DateTimeField', 'TimeField',
2251     'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
2252     'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
2253     'ComboField', 'MultiValueField', 'FloatField', 'DecimalField',
2254@@ -200,7 +199,9 @@ class FloatField(Field):
2255         if not self.required and value in EMPTY_VALUES:
2256             return None
2257         try:
2258-            value = float(value)
2259+            # We always accept dot as decimal separator
2260+            if isinstance(value, str) or isinstance(value, unicode):
2261+                value = float(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
2262         except (ValueError, TypeError):
2263             raise ValidationError(self.error_messages['invalid'])
2264         if self.max_value is not None and value > self.max_value:
2265@@ -236,7 +237,9 @@ class DecimalField(Field):
2266             return None
2267         value = smart_str(value).strip()
2268         try:
2269-            value = Decimal(value)
2270+            # We always accept dot as decimal separator
2271+            if isinstance(value, str) or isinstance(value, unicode):
2272+                value = Decimal(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
2273         except DecimalException:
2274             raise ValidationError(self.error_messages['invalid'])
2275 
2276@@ -264,14 +267,6 @@ class DecimalField(Field):
2277             raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places))
2278         return value
2279 
2280-DEFAULT_DATE_INPUT_FORMATS = (
2281-    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
2282-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
2283-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
2284-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
2285-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
2286-)
2287-
2288 class DateField(Field):
2289     widget = DateInput
2290     default_error_messages = {
2291@@ -280,7 +275,7 @@ class DateField(Field):
2292 
2293     def __init__(self, input_formats=None, *args, **kwargs):
2294         super(DateField, self).__init__(*args, **kwargs)
2295-        self.input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
2296+        self.input_formats = input_formats
2297 
2298     def clean(self, value):
2299         """
2300@@ -294,18 +289,13 @@ class DateField(Field):
2301             return value.date()
2302         if isinstance(value, datetime.date):
2303             return value
2304-        for format in self.input_formats:
2305+        for format in self.input_formats or getformat('DATE_INPUT_FORMATS'):
2306             try:
2307                 return datetime.date(*time.strptime(value, format)[:3])
2308             except ValueError:
2309                 continue
2310         raise ValidationError(self.error_messages['invalid'])
2311 
2312-DEFAULT_TIME_INPUT_FORMATS = (
2313-    '%H:%M:%S',     # '14:30:59'
2314-    '%H:%M',        # '14:30'
2315-)
2316-
2317 class TimeField(Field):
2318     widget = TimeInput
2319     default_error_messages = {
2320@@ -314,7 +304,7 @@ class TimeField(Field):
2321 
2322     def __init__(self, input_formats=None, *args, **kwargs):
2323         super(TimeField, self).__init__(*args, **kwargs)
2324-        self.input_formats = input_formats or DEFAULT_TIME_INPUT_FORMATS
2325+        self.input_formats = input_formats
2326 
2327     def clean(self, value):
2328         """
2329@@ -326,25 +316,13 @@ class TimeField(Field):
2330             return None
2331         if isinstance(value, datetime.time):
2332             return value
2333-        for format in self.input_formats:
2334+        for format in self.input_formats or getformat('TIME_INPUT_FORMATS'):
2335             try:
2336                 return datetime.time(*time.strptime(value, format)[3:6])
2337             except ValueError:
2338                 continue
2339         raise ValidationError(self.error_messages['invalid'])
2340 
2341-DEFAULT_DATETIME_INPUT_FORMATS = (
2342-    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
2343-    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
2344-    '%Y-%m-%d',              # '2006-10-25'
2345-    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
2346-    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
2347-    '%m/%d/%Y',              # '10/25/2006'
2348-    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
2349-    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
2350-    '%m/%d/%y',              # '10/25/06'
2351-)
2352-
2353 class DateTimeField(Field):
2354     widget = DateTimeInput
2355     default_error_messages = {
2356@@ -353,7 +331,7 @@ class DateTimeField(Field):
2357 
2358     def __init__(self, input_formats=None, *args, **kwargs):
2359         super(DateTimeField, self).__init__(*args, **kwargs)
2360-        self.input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
2361+        self.input_formats = input_formats
2362 
2363     def clean(self, value):
2364         """
2365@@ -373,7 +351,7 @@ class DateTimeField(Field):
2366             if len(value) != 2:
2367                 raise ValidationError(self.error_messages['invalid'])
2368             value = '%s %s' % tuple(value)
2369-        for format in self.input_formats:
2370+        for format in self.input_formats or getformat('DATETIME_INPUT_FORMATS'):
2371             try:
2372                 return datetime.datetime(*time.strptime(value, format)[:6])
2373             except ValueError:
2374diff --git a/django/forms/widgets.py b/django/forms/widgets.py
2375index d59e634..aabd1b0 100644
2376--- a/django/forms/widgets.py
2377+++ b/django/forms/widgets.py
2378@@ -10,6 +10,7 @@ from django.utils.html import escape, conditional_escape
2379 from django.utils.translation import ugettext
2380 from django.utils.encoding import StrAndUnicode, force_unicode
2381 from django.utils.safestring import mark_safe
2382+from django.utils.formats import localize
2383 from django.utils import datetime_safe
2384 from datetime import time
2385 from util import flatatt
2386@@ -208,7 +209,7 @@ class Input(Widget):
2387         final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
2388         if value != '':
2389             # Only add the 'value' attribute if a value is non-empty.
2390-            final_attrs['value'] = force_unicode(value)
2391+            final_attrs['value'] = force_unicode(localize(value, is_input=True))
2392         return mark_safe(u'<input%s />' % flatatt(final_attrs))
2393 
2394 class TextInput(Input):
2395diff --git a/django/template/__init__.py b/django/template/__init__.py
2396index 8764bfa..4c386be 100644
2397--- a/django/template/__init__.py
2398+++ b/django/template/__init__.py
2399@@ -60,6 +60,7 @@ from django.utils.text import smart_split, unescape_string_literal
2400 from django.utils.encoding import smart_unicode, force_unicode, smart_str
2401 from django.utils.translation import ugettext as _
2402 from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping
2403+from django.utils.formats import localize
2404 from django.utils.html import escape
2405 
2406 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
2407@@ -815,6 +816,7 @@ def _render_value_in_context(value, context):
2408     means escaping, if required, and conversion to a unicode object. If value
2409     is a string, it is expected to have already been translated.
2410     """
2411+    value = localize(value)
2412     value = force_unicode(value)
2413     if (context.autoescape and not isinstance(value, SafeData)) or isinstance(value, EscapeData):
2414         return escape(value)
2415diff --git a/django/template/debug.py b/django/template/debug.py
2416index c58c854..382fb75 100644
2417--- a/django/template/debug.py
2418+++ b/django/template/debug.py
2419@@ -2,6 +2,7 @@ from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, Templ
2420 from django.utils.encoding import force_unicode
2421 from django.utils.html import escape
2422 from django.utils.safestring import SafeData, EscapeData
2423+from django.utils.formats import localize
2424 
2425 class DebugLexer(Lexer):
2426     def __init__(self, template_string, origin):
2427@@ -84,7 +85,9 @@ class DebugNodeList(NodeList):
2428 class DebugVariableNode(VariableNode):
2429     def render(self, context):
2430         try:
2431-            output = force_unicode(self.filter_expression.resolve(context))
2432+            output = self.filter_expression.resolve(context)
2433+            output = localize(output)
2434+            output = force_unicode(output)
2435         except TemplateSyntaxError, e:
2436             if not hasattr(e, 'source'):
2437                 e.source = self.source
2438diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
2439index a8c2567..26b6b5e 100644
2440--- a/django/template/defaultfilters.py
2441+++ b/django/template/defaultfilters.py
2442@@ -18,6 +18,7 @@ from django.conf import settings
2443 from django.utils.translation import ugettext, ungettext
2444 from django.utils.encoding import force_unicode, iri_to_uri
2445 from django.utils.safestring import mark_safe, SafeData
2446+from django.utils.formats import date_format, number_format
2447 
2448 register = Library()
2449 
2450@@ -166,14 +167,14 @@ def floatformat(text, arg=-1):
2451         return input_val
2452 
2453     if not m and p < 0:
2454-        return mark_safe(u'%d' % (int(d)))
2455+        return mark_safe(number_format(u'%d' % (int(d)), 0))
2456 
2457     if p == 0:
2458         exp = Decimal(1)
2459     else:
2460         exp = Decimal('1.0') / (Decimal(10) ** abs(p))
2461     try:
2462-        return mark_safe(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)))
2463+        return mark_safe(number_format(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)), abs(p)))
2464     except InvalidOperation:
2465         return input_val
2466 floatformat.is_safe = True
2467@@ -685,9 +686,12 @@ def date(value, arg=None):
2468     if arg is None:
2469         arg = settings.DATE_FORMAT
2470     try:
2471-        return format(value, arg)
2472+        return date_format(value, arg)
2473     except AttributeError:
2474-        return ''
2475+        try:
2476+            return format(value, arg)
2477+        except AttributeError:
2478+            return ''
2479 date.is_safe = False
2480 
2481 def time(value, arg=None):
2482@@ -698,9 +702,12 @@ def time(value, arg=None):
2483     if arg is None:
2484         arg = settings.TIME_FORMAT
2485     try:
2486-        return time_format(value, arg)
2487+        return date_format(value, arg)
2488     except AttributeError:
2489-        return ''
2490+        try:
2491+            return time_format(value, arg)
2492+        except AttributeError:
2493+            return ''
2494 time.is_safe = False
2495 
2496 def timesince(value, arg=None):
2497diff --git a/django/utils/formats.py b/django/utils/formats.py
2498new file mode 100644
2499index 0000000..51737b2
2500--- /dev/null
2501+++ b/django/utils/formats.py
2502@@ -0,0 +1,97 @@
2503+import decimal
2504+import datetime
2505+
2506+from django.conf import settings
2507+from django.utils.translation import get_language, to_locale, check_for_language
2508+from django.utils.importlib import import_module
2509+from django.utils import dateformat
2510+from django.utils import numberformat
2511+
2512+def get_format_modules():
2513+    """
2514+    Returns an iterator over the format modules found in the project and Django
2515+    """
2516+    modules = []
2517+    if not check_for_language(get_language()):
2518+        return modules
2519+    locale = to_locale(get_language())
2520+    if settings.FORMAT_MODULE_PATH:
2521+        format_locations = [settings.FORMAT_MODULE_PATH + '.%s']
2522+    else:
2523+        format_locations = []
2524+    format_locations.append('django.conf.locale.%s')
2525+    for location in format_locations:
2526+        for l in (locale, locale.split('_')[0]):
2527+            try:
2528+                mod = import_module('.formats', location % l)
2529+            except ImportError:
2530+                pass
2531+            else:
2532+                # Don't return duplicates
2533+                if mod not in modules:
2534+                    modules.append(mod)
2535+    return modules
2536+
2537+def getformat(format_type):
2538+    """
2539+    For a specific format type, returns the format for the
2540+    current language (locale) defaulting to the format on settings.
2541+    format_type is the name of the format, for example 'DATE_FORMAT'
2542+    """
2543+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2544+        for module in get_format_modules():
2545+            try:
2546+                return getattr(module, format_type)
2547+            except AttributeError:
2548+                pass
2549+    return getattr(settings, format_type)
2550+
2551+def date_format(value, format=None):
2552+    """
2553+    Formats a datetime.date or datetime.datetime object using a
2554+    localizable format
2555+    """
2556+    return dateformat.format(value, getformat(format or 'DATE_FORMAT'))
2557+
2558+def number_format(value, decimal_pos=None):
2559+    """
2560+    Formats a numeric value using localization settings
2561+    """
2562+    return numberformat.format(
2563+        value,
2564+        getformat('DECIMAL_SEPARATOR'),
2565+        decimal_pos,
2566+        getformat('NUMBER_GROUPING'),
2567+        getformat('THOUSAND_SEPARATOR'),
2568+    )
2569+
2570+def localize(value, is_input=False):
2571+    """
2572+    Checks value, and if it has a localizable type (date,
2573+    number...) it returns the value as a string using
2574+    current locale format
2575+    """
2576+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2577+        if isinstance(value, decimal.Decimal):
2578+            return number_format(value)
2579+        elif isinstance(value, float):
2580+            return number_format(value)
2581+        elif isinstance(value, int):
2582+            return number_format(value)
2583+        elif isinstance(value, datetime.datetime):
2584+            if not is_input:
2585+                return date_format(value, 'DATETIME_FORMAT')
2586+            else:
2587+                return value.strftime(getformat('DATETIME_INPUT_FORMATS')[0])
2588+        elif isinstance(value, datetime.date):
2589+            if not is_input:
2590+                return date_format(value)
2591+            else:
2592+                return value.strftime(getformat('DATE_INPUT_FORMATS')[0])
2593+        elif isinstance(value, datetime.time):
2594+            if not is_input:
2595+                return date_format(value, 'TIME_FORMAT')
2596+            else:
2597+                return value.strftime(getformat('TIME_INPUT_FORMATS')[0])
2598+    return value
2599+
2600diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
2601new file mode 100644
2602index 0000000..78ecb2f
2603--- /dev/null
2604+++ b/django/utils/numberformat.py
2605@@ -0,0 +1,42 @@
2606+from django.conf import settings
2607+
2608+def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
2609+    """
2610+    Gets a number (as a number or string), and returns it as a string,
2611+    using formats definied as arguments:
2612+
2613+    * decimal_sep: Decimal separator symbol (for example ".")
2614+    * decimal_pos: Number of decimal positions
2615+    * grouping: Number of digits in every group limited by thousand separator
2616+    * thousand_sep: Thousand separator symbol (for example ",")
2617+
2618+    """
2619+    # sign
2620+    if float(number) < 0:
2621+        sign = '-'
2622+    else:
2623+        sign = ''
2624+    # decimal part
2625+    str_number = unicode(number)
2626+    if str_number[0] == '-':
2627+        str_number = str_number[1:]
2628+    if '.' in str_number:
2629+        int_part, dec_part = str_number.split('.')
2630+        if decimal_pos:
2631+            dec_part = dec_part[:decimal_pos]
2632+    else:
2633+        int_part, dec_part = str_number, ''
2634+    if decimal_pos:
2635+        dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
2636+    if dec_part: dec_part = decimal_sep + dec_part
2637+    # grouping
2638+    if settings.USE_THOUSAND_SEPARATOR and grouping:
2639+        int_part_gd = ''
2640+        for cnt, digit in enumerate(int_part[::-1]):
2641+            if cnt and not cnt % grouping:
2642+                int_part_gd += thousand_sep
2643+            int_part_gd += digit
2644+        int_part = int_part_gd[::-1]
2645+
2646+    return sign + int_part + dec_part
2647+
2648diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py
2649index 98c6de6..50f41a2 100644
2650--- a/django/utils/translation/trans_null.py
2651+++ b/django/utils/translation/trans_null.py
2652@@ -2,6 +2,7 @@
2653 # that don't actually do anything. This is purely for performance, so that
2654 # settings.USE_I18N = False can use this module rather than trans_real.py.
2655 
2656+import warnings
2657 from django.conf import settings
2658 from django.utils.encoding import force_unicode
2659 from django.utils.safestring import mark_safe, SafeData
2660@@ -18,10 +19,10 @@ activate = lambda x: None
2661 deactivate = deactivate_all = lambda: None
2662 get_language = lambda: settings.LANGUAGE_CODE
2663 get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
2664-get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
2665-get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
2666 check_for_language = lambda x: True
2667 
2668+# date formats shouldn't be used using gettext anymore. This
2669+# is kept for backward compatibility
2670 TECHNICAL_ID_MAP = {
2671     "DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
2672     "DATE_FORMAT": settings.DATE_FORMAT,
2673@@ -51,3 +52,21 @@ def to_locale(language):
2674 
2675 def get_language_from_request(request):
2676     return settings.LANGUAGE_CODE
2677+
2678+# get_date_formats and get_partial_date_formats aren't used anymore by Django
2679+# but are kept for backward compatibility.
2680+def get_date_formats():
2681+    warnings.warn(
2682+        '`django.utils.translation.get_date_formats` is deprecated. '
2683+        'Please update your code to use the new i18n aware formatting.',
2684+        PendingDeprecationWarning
2685+    )
2686+    return settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT
2687+
2688+def get_partial_date_formats():
2689+    warnings.warn(
2690+        '`django.utils.translation.get_partial_date_formats` is deprecated. '
2691+        'Please update your code to use the new i18n aware formatting.',
2692+        PendingDeprecationWarning
2693+    )
2694+    return settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT
2695diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
2696index 48ed7cc..8b7db0f 100644
2697--- a/django/utils/translation/trans_real.py
2698+++ b/django/utils/translation/trans_real.py
2699@@ -4,6 +4,7 @@ import locale
2700 import os
2701 import re
2702 import sys
2703+import warnings
2704 import gettext as gettext_module
2705 from cStringIO import StringIO
2706 
2707@@ -266,15 +267,16 @@ def do_translate(message, translation_function):
2708     translation object to use. If no current translation is activated, the
2709     message will be run through the default translation object.
2710     """
2711+    eol_message = message.replace('\r\n', '\n').replace('\r', '\n')
2712     global _default, _active
2713     t = _active.get(currentThread(), None)
2714     if t is not None:
2715-        result = getattr(t, translation_function)(message)
2716+        result = getattr(t, translation_function)(eol_message)
2717     else:
2718         if _default is None:
2719             from django.conf import settings
2720             _default = translation(settings.LANGUAGE_CODE)
2721-        result = getattr(_default, translation_function)(message)
2722+        result = getattr(_default, translation_function)(eol_message)
2723     if isinstance(message, SafeData):
2724         return mark_safe(result)
2725     return result
2726@@ -389,39 +391,6 @@ def get_language_from_request(request):
2727 
2728     return settings.LANGUAGE_CODE
2729 
2730-def get_date_formats():
2731-    """
2732-    Checks whether translation files provide a translation for some technical
2733-    message ID to store date and time formats. If it doesn't contain one, the
2734-    formats provided in the settings will be used.
2735-    """
2736-    from django.conf import settings
2737-    date_format = ugettext('DATE_FORMAT')
2738-    datetime_format = ugettext('DATETIME_FORMAT')
2739-    time_format = ugettext('TIME_FORMAT')
2740-    if date_format == 'DATE_FORMAT':
2741-        date_format = settings.DATE_FORMAT
2742-    if datetime_format == 'DATETIME_FORMAT':
2743-        datetime_format = settings.DATETIME_FORMAT
2744-    if time_format == 'TIME_FORMAT':
2745-        time_format = settings.TIME_FORMAT
2746-    return date_format, datetime_format, time_format
2747-
2748-def get_partial_date_formats():
2749-    """
2750-    Checks whether translation files provide a translation for some technical
2751-    message ID to store partial date formats. If it doesn't contain one, the
2752-    formats provided in the settings will be used.
2753-    """
2754-    from django.conf import settings
2755-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2756-    month_day_format = ugettext('MONTH_DAY_FORMAT')
2757-    if year_month_format == 'YEAR_MONTH_FORMAT':
2758-        year_month_format = settings.YEAR_MONTH_FORMAT
2759-    if month_day_format == 'MONTH_DAY_FORMAT':
2760-        month_day_format = settings.MONTH_DAY_FORMAT
2761-    return year_month_format, month_day_format
2762-
2763 dot_re = re.compile(r'\S')
2764 def blankout(src, char):
2765     """
2766@@ -537,3 +506,52 @@ def parse_accept_lang_header(lang_string):
2767         result.append((lang, priority))
2768     result.sort(lambda x, y: -cmp(x[1], y[1]))
2769     return result
2770+
2771+# get_date_formats and get_partial_date_formats aren't used anymore by Django
2772+# and are kept for backward compatibility.
2773+# Note, it's also important to keep format names marked for translation.
2774+# For compatibility we still want to have formats on translation catalogs.
2775+# That makes template code like {{ my_date|date:_('DATE_FORMAT') }} still work
2776+def get_date_formats():
2777+    """
2778+    Checks whether translation files provide a translation for some technical
2779+    message ID to store date and time formats. If it doesn't contain one, the
2780+    formats provided in the settings will be used.
2781+    """
2782+    warnings.warn(
2783+        '`django.utils.translation.get_date_formats` is deprecated. '
2784+        'Please update your code to use the new i18n aware formatting.',
2785+        PendingDeprecationWarning
2786+    )
2787+    from django.conf import settings
2788+    date_format = ugettext('DATE_FORMAT')
2789+    datetime_format = ugettext('DATETIME_FORMAT')
2790+    time_format = ugettext('TIME_FORMAT')
2791+    if date_format == 'DATE_FORMAT':
2792+        date_format = settings.DATE_FORMAT
2793+    if datetime_format == 'DATETIME_FORMAT':
2794+        datetime_format = settings.DATETIME_FORMAT
2795+    if time_format == 'TIME_FORMAT':
2796+        time_format = settings.TIME_FORMAT
2797+    return date_format, datetime_format, time_format
2798+
2799+def get_partial_date_formats():
2800+    """
2801+    Checks whether translation files provide a translation for some technical
2802+    message ID to store partial date formats. If it doesn't contain one, the
2803+    formats provided in the settings will be used.
2804+    """
2805+    warnings.warn(
2806+        '`django.utils.translation.get_partial_date_formats` is deprecated. '
2807+        'Please update your code to use the new i18n aware formatting.',
2808+        PendingDeprecationWarning
2809+    )
2810+    from django.conf import settings
2811+    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2812+    month_day_format = ugettext('MONTH_DAY_FORMAT')
2813+    if year_month_format == 'YEAR_MONTH_FORMAT':
2814+        year_month_format = settings.YEAR_MONTH_FORMAT
2815+    if month_day_format == 'MONTH_DAY_FORMAT':
2816+        month_day_format = settings.MONTH_DAY_FORMAT
2817+    return year_month_format, month_day_format
2818+
2819diff --git a/django/views/i18n.py b/django/views/i18n.py
2820index 0280698..ddd7520 100644
2821--- a/django/views/i18n.py
2822+++ b/django/views/i18n.py
2823@@ -1,10 +1,12 @@
2824+import os
2825+import gettext as gettext_module
2826+
2827 from django import http
2828 from django.conf import settings
2829 from django.utils import importlib
2830 from django.utils.translation import check_for_language, activate, to_locale, get_language
2831 from django.utils.text import javascript_quote
2832-import os
2833-import gettext as gettext_module
2834+from django.utils.formats import get_format_modules
2835 
2836 def set_language(request):
2837     """
2838@@ -32,6 +34,24 @@ def set_language(request):
2839                 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
2840     return response
2841 
2842+def get_formats():
2843+    """
2844+    Returns an iterator over all formats in formats file
2845+    """
2846+    FORMAT_SETTINGS = ('DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT',
2847+        'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT',
2848+        'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR',
2849+        'THOUSAND_SEPARATOR', 'NUMBER_GROUPING')
2850+
2851+    result = {}
2852+    for module in [settings] + get_format_modules():
2853+        for attr in FORMAT_SETTINGS:
2854+            try:
2855+                result[attr] = getattr(module, attr)
2856+            except AttributeError:
2857+                pass
2858+    return result
2859+
2860 NullSource = """
2861 /* gettext identity library */
2862 
2863@@ -185,10 +205,13 @@ def javascript_catalog(request, domain='djangojs', packages=None):
2864         else:
2865             raise TypeError, k
2866     csrc.sort()
2867-    for k,v in pdict.items():
2868+    for k, v in pdict.items():
2869         src.append("catalog['%s'] = [%s];\n" % (javascript_quote(k), ','.join(["''"]*(v+1))))
2870+    for k, v in get_formats().items():
2871+        src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v))))
2872     src.extend(csrc)
2873     src.append(LibFoot)
2874     src.append(InterPolate)
2875     src = ''.join(src)
2876     return http.HttpResponse(src, 'text/javascript')
2877+
2878diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
2879index 8ff1509..1b57adf 100644
2880--- a/docs/ref/settings.txt
2881+++ b/docs/ref/settings.txt
2882@@ -288,12 +288,32 @@ DATE_FORMAT
2883 
2884 Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
2885 
2886-The default formatting to use for date fields on Django admin change-list
2887-pages -- and, possibly, by other parts of the system. See
2888-:ttag:`allowed date format strings <now>`.
2889+The default formatting to use for date fields in any part of the system.
2890+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2891+be applied. See :ttag:`allowed date format strings <now>`.
2892+
2893+See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.
2894+
2895+.. setting:: DATE_INPUT_FORMATS
2896 
2897-See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``
2898-and ``MONTH_DAY_FORMAT``.
2899+DATE_INPUT_FORMATS
2900+------------------
2901+
2902+Default::
2903+
2904+    ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
2905+    '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
2906+    '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
2907+
2908+A tuple of formats that will be accepted when inputting data on a date
2909+field. Formats will be tried in order, using the first valid.
2910+Note that these format strings are specified in Python's datetime_ module
2911+syntax, that is different from the one used by Django for formatting dates
2912+to be displayed.
2913+
2914+See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2915+
2916+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2917 
2918 .. setting:: DATETIME_FORMAT
2919 
2920@@ -302,12 +322,32 @@ DATETIME_FORMAT
2921 
2922 Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
2923 
2924-The default formatting to use for datetime fields on Django admin change-list
2925-pages -- and, possibly, by other parts of the system. See
2926-:ttag:`allowed date format strings <now>`.
2927+The default formatting to use for datetime fields in any part of the system.
2928+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2929+be applied. See :ttag:`allowed date format strings <now>`.
2930+
2931+See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2932 
2933-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
2934-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
2935+.. setting:: DATETIME_INPUT_FORMATS
2936+
2937+DATETIME_INPUT_FORMATS
2938+----------------------
2939+
2940+Default::
2941+
2942+    ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
2943+    '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
2944+    '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
2945+
2946+A tuple of formats that will be accepted when inputting data on a datetime
2947+field. Formats will be tried in order, using the first valid.
2948+Note that these format strings are specified in Python's datetime_ module
2949+syntax, that is different from the one used by Django for formatting dates
2950+to be displayed.
2951+
2952+See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2953+
2954+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2955 
2956 .. setting:: DEBUG
2957 
2958@@ -347,6 +387,14 @@ will be suppressed, and exceptions will propagate upwards.  This can
2959 be useful for some test setups, and should never be used on a live
2960 site.
2961 
2962+.. setting:: DECIMAL_SEPARATOR
2963+
2964+DECIMAL_SEPARATOR
2965+-----------------
2966+
2967+Default: ``'.'`` (Dot)
2968+
2969+Default decimal separator used when formatting decimal numbers.
2970 
2971 .. setting:: DEFAULT_CHARSET
2972 
2973@@ -596,6 +644,21 @@ system's standard umask.
2974 
2975 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
2976 
2977+.. setting:: FIRST_DAY_OF_WEEK
2978+
2979+FIRST_DAY_OF_WEEK
2980+-----------------
2981+
2982+Default: ``0`` (Sunday)
2983+
2984+Number representing the first day of the week. This is specially useful
2985+when displaying a calendar. This value is only used when not using
2986+format internationalization, or when a format cannot be found for the
2987+current locale.
2988+
2989+The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
2990+Monday and so on.
2991+
2992 .. setting:: FIXTURE_DIRS
2993 
2994 FIXTURE_DIRS
2995@@ -617,6 +680,34 @@ environment variable in any HTTP request. This setting can be used to override
2996 the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
2997 of the preferred value or not supplied at all.
2998 
2999+.. setting:: FORMAT_MODULE_PATH
3000+
3001+FORMAT_MODULE_PATH
3002+------------------
3003+
3004+Default: ``None``
3005+
3006+A full Python path to a Python package that contains format definitions for
3007+project locales. If not ``None``, Django will check for a ``formats.py``
3008+file, under the directory named as the current locale, and will use the
3009+formats defined on this file.
3010+
3011+For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and
3012+current language is ``en`` (English), Django will expect a directory tree
3013+like::
3014+
3015+    mysite/
3016+        formats/
3017+            __init__.py
3018+            en/
3019+                __init__.py
3020+                formats.py
3021+
3022+Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,
3023+``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,
3024+``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,
3025+``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
3026+
3027 .. setting:: IGNORABLE_404_ENDS
3028 
3029 IGNORABLE_404_ENDS
3030@@ -886,6 +977,21 @@ locales have different formats. For example, U.S. English would say
3031 See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
3032 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
3033 
3034+.. setting:: NUMBER_GROUPING
3035+
3036+NUMBER_GROUPING
3037+----------------
3038+
3039+Default: ``0``
3040+
3041+Number of digits grouped together on the integer part of a number. Common use
3042+is to display a thousand separator. If this setting is ``0``, then, no grouping
3043+will be applied to the number. If this setting is greater than ``0`` then the
3044+setting ``THOUSAND_SEPARATOR`` will be used as the separator between those
3045+groups.
3046+
3047+See also ``THOUSAND_SEPARATOR``
3048+
3049 .. setting:: PREPEND_WWW
3050 
3051 PREPEND_WWW
3052@@ -1077,6 +1183,32 @@ Default: ``False``
3053 Whether to save the session data on every request. See
3054 :ref:`topics-http-sessions`.
3055 
3056+.. setting:: SHORT_DATE_FORMAT
3057+
3058+SHORT_DATE_FORMAT
3059+-----------------
3060+
3061+Default: ``m/d/Y`` (e.g. ``12/31/2003``)
3062+
3063+An available formatting that can be used for date fields on templates.
3064+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
3065+be applied. See :ttag:`allowed date format strings <now>`.
3066+
3067+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
3068+
3069+.. setting:: SHORT_DATETIME_FORMAT
3070+
3071+SHORT_DATETIME_FORMAT
3072+---------------------
3073+
3074+Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
3075+
3076+An available formatting that can be used for datetime fields on templates.
3077+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
3078+be applied. See :ttag:`allowed date format strings <now>`.
3079+
3080+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
3081+
3082 .. setting:: SITE_ID
3083 
3084 SITE_ID
3085@@ -1231,6 +1363,18 @@ The name of the method to use for starting the test suite. See
3086 
3087 .. _Testing Django Applications: ../testing/
3088 
3089+.. setting:: THOUSAND_SEPARATOR
3090+
3091+THOUSAND_SEPARATOR
3092+------------------
3093+
3094+Default ``,`` (Comma)
3095+
3096+Default thousand separator used when formatting numbers. This setting is
3097+used only when ``NUMBER_GROUPPING`` is set.
3098+
3099+See also ``NUMBER_GROUPPING``, ``DECIMAL_SEPARATOR``
3100+
3101 .. setting:: TIME_FORMAT
3102 
3103 TIME_FORMAT
3104@@ -1238,12 +1382,28 @@ TIME_FORMAT
3105 
3106 Default: ``'P'`` (e.g. ``4 p.m.``)
3107 
3108-The default formatting to use for time fields on Django admin change-list
3109-pages -- and, possibly, by other parts of the system. See
3110-:ttag:`allowed date format strings <now>`.
3111+The default formatting to use for time fields in any part of the system.
3112+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
3113+be applied. See :ttag:`allowed date format strings <now>`.
3114 
3115-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
3116-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
3117+See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.
3118+
3119+.. setting:: TIME_INPUT_FORMATS
3120+
3121+TIME_INPUT_FORMATS
3122+------------------
3123+
3124+Default: ``('%H:%M:%S', '%H:%M')``
3125+
3126+A tuple of formats that will be accepted when inputting data on a time
3127+field. Formats will be tried in order, using the first valid.
3128+Note that these format strings are specified in Python's datetime_ module
3129+syntax, that is different from the one used by Django for formatting dates
3130+to be displayed.
3131+
3132+See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.
3133+
3134+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
3135 
3136 .. setting:: TIME_ZONE
3137 
3138@@ -1298,6 +1458,20 @@ A boolean that specifies whether to output the "Etag" header. This saves
3139 bandwidth but slows down performance. This is only used if ``CommonMiddleware``
3140 is installed (see :ref:`topics-http-middleware`).
3141 
3142+.. setting:: USE_FORMAT_I18N
3143+
3144+USE_FORMAT_I18N
3145+---------------
3146+
3147+Default ``False``
3148+
3149+A boolean that specifies if data will be localized by default or not. If this is
3150+set to ``True``, Django will display numbers and dates using the format of the
3151+current locale. It is required to set ``USE_I18N`` to ``True`` to allow data
3152+format localization.
3153+
3154+See also ``USE_I18N``
3155+
3156 .. setting:: USE_I18N
3157 
3158 USE_I18N
3159@@ -1310,6 +1484,22 @@ enabled. This provides an easy way to turn it off, for performance. If this is
3160 set to ``False``, Django will make some optimizations so as not to load the
3161 internationalization machinery.
3162 
3163+See also ``USE_FORMAT_I18N``
3164+
3165+.. setting:: USE_THOUSAND_SEPARATOR
3166+
3167+USE_THOUSAND_SEPARATOR
3168+----------------------
3169+
3170+Default ``False``
3171+
3172+A boolean that specifies wheter to display numbers using a thousand separator.
3173+If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``
3174+and ``NUMBER_GROUPING`` from current locale, to format the number.
3175+``USE_FORMAT_I18N`` must be set to ``True``, in order to format numbers.
3176+
3177+See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
3178+
3179 .. setting:: YEAR_MONTH_FORMAT
3180 
3181 YEAR_MONTH_FORMAT
3182diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
3183index bf2d9e8..29ccfef 100644
3184--- a/docs/ref/templates/builtins.txt
3185+++ b/docs/ref/templates/builtins.txt
3186@@ -1047,7 +1047,11 @@ If ``value`` is ``"String with spaces"``, the output will be ``"Stringwithspaces
3187 date
3188 ~~~~
3189 
3190-Formats a date according to the given format (same as the `now`_ tag).
3191+Formats a date according to the given format.
3192+
3193+Given format can be one of the predefined ones ``DATE_FORMAT``, ``DATETIME_FORMAT``,
3194+``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a custom format, same as the
3195+`now`_ tag. Note that prefedined formats vary depending on the current locale.
3196 
3197 For example::
3198 
3199@@ -1062,7 +1066,7 @@ When used without a format string::
3200     {{ value|date }}
3201 
3202 ...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
3203-used.
3204+used, without applying any localization.
3205 
3206 .. templatefilter:: default
3207 
3208@@ -1610,7 +1614,11 @@ output will be ``"Joel is a slug"``.
3209 time
3210 ~~~~
3211 
3212-Formats a time according to the given format (same as the `now`_ tag).
3213+Formats a time according to the given format.
3214+
3215+Given format can be the predefined one ``TIME_FORMAT``, or a custom format,
3216+same as the `now`_ tag. Note that the predefined format is locale depending.
3217+
3218 The time filter will only accept parameters in the format string that relate
3219 to the time of day, not the date (for obvious reasons). If you need to
3220 format a date, use the `date`_ filter.
3221@@ -1627,7 +1635,7 @@ When used without a format string::
3222     {{ value|time }}
3223 
3224 ...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
3225-used.
3226+used, without aplying any localization.
3227 
3228 .. templatefilter:: timesince
3229 
3230diff --git a/docs/topics/i18n.txt b/docs/topics/i18n.txt
3231index c5f4ab6..0fd2663 100644
3232--- a/docs/topics/i18n.txt
3233+++ b/docs/topics/i18n.txt
3234@@ -4,20 +4,21 @@
3235 Internationalization
3236 ====================
3237 
3238-Django has full support for internationalization of text in code and templates.
3239-Here's how it works.
3240+Django has full support for internationalization, including translation
3241+capabilities of text in code and templates, and format localization for
3242+dates and numbers. Here's how it works.
3243 
3244 Overview
3245 ========
3246 
3247 The goal of internationalization is to allow a single Web application to offer
3248-its content and functionality in multiple languages.
3249+its content and functionality in multiple languages and locales.
3250 
3251-You, the Django developer, can accomplish this goal by adding a minimal amount
3252-of hooks to your Python code and templates. These hooks are called
3253-**translation strings**. They tell Django: "This text should be translated into
3254-the end user's language, if a translation for this text is available in that
3255-language."
3256+For text translation, you, the Django developer, can accomplish this goal by
3257+adding a minimal amount of hooks to your Python code and templates. These hooks
3258+are called **translation strings**. They tell Django: "This text should be
3259+translated into the end user's language, if a translation for this text is
3260+available in that language."
3261 
3262 Django takes care of using these hooks to translate Web apps, on the fly,
3263 according to users' language preferences.
3264@@ -29,6 +30,12 @@ Essentially, Django does two things:
3265     * It uses these hooks to translate Web apps for particular users according
3266       to their language preferences.
3267 
3268+For format localization, it's just necessary to set
3269+:setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings file. If
3270+:settings:`USE_FORMAT_I18N` is set to ``True``, then Django will display
3271+numbers and dates in the format of the current locale. That includes field
3272+representation on templates, and allowed input formats on the admin.
3273+
3274 If you don't need internationalization in your app
3275 ==================================================
3276 
3277@@ -1074,3 +1081,53 @@ have been found to not support this command. Do not attempt to use Django
3278 translation utilities with a ``gettext`` package if the command ``xgettext
3279 --version`` entered at a Windows command prompt causes a popup window saying
3280 "xgettext.exe has generated errors and will be closed by Windows".
3281+
3282+Format localization
3283+===================
3284+
3285+Django's formatting system is disabled by default. To enable it, it's necessay
3286+to set :setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings
3287+file.  Note that :setting:`USE_FORMAT_I18N` requires `USE_I18N` to be ``True``.
3288+
3289+When using Django's formatting system, dates and numbers on templates will be
3290+displayed using the format specified for the current locale. That means, two
3291+users accessing the same content, but in different language, will see date and
3292+number fields formatted in different ways, depending on the format for their
3293+current locale.
3294+
3295+Django will also use localized formats when parsing data in forms. That means
3296+Django uses different formats for different locales when guessing the format
3297+used by the user when inputting data on forms. Note that Django uses different
3298+formats for displaying data, and for parsing it.
3299+
3300+Creating custom format files
3301+----------------------------
3302+
3303+Django provides format definitions for many locales, but sometimes you could
3304+want to create your own ones, because a format files doesn't exist for your
3305+locale, or because you want to overwrite some of the values.
3306+
3307+To use custom formats, first thing to do, is to specify the path where you'll
3308+place format files. To do that, just set :setting:`FORMAT_MODULE_PATH` setting
3309+to the the path (in the format ``'foo.bar.baz``) where format files will
3310+exists.
3311+
3312+Files are not placed directly in this directory, but in a directory named as
3313+the locale. File must be named ``formats.py``.
3314+
3315+For customazing English formats, a structure like this would be needed::
3316+
3317+    mysite/
3318+        formats/
3319+            __init__.py
3320+            en/
3321+                __init__.py
3322+                formats.py
3323+
3324+where :file:`formats.py` contains custom format definitions. For example::
3325+
3326+    THOUSAND_SEPARATOR = ' '
3327+
3328+to use a space as thousand separator, instead of the default for English,
3329+comma.
3330+
3331diff --git a/tests/regressiontests/i18n/misc.py b/tests/regressiontests/i18n/misc.py
3332deleted file mode 100644
3333index f8f35ad..0000000
3334--- a/tests/regressiontests/i18n/misc.py
3335+++ /dev/null
3336@@ -1,114 +0,0 @@
3337-import sys
3338-
3339-tests = """
3340->>> from django.utils.translation.trans_real import parse_accept_lang_header
3341->>> p = parse_accept_lang_header
3342-
3343-#
3344-# Testing HTTP header parsing. First, we test that we can parse the values
3345-# according to the spec (and that we extract all the pieces in the right order).
3346-#
3347-
3348-Good headers.
3349->>> p('de')
3350-[('de', 1.0)]
3351->>> p('en-AU')
3352-[('en-AU', 1.0)]
3353->>> p('*;q=1.00')
3354-[('*', 1.0)]
3355->>> p('en-AU;q=0.123')
3356-[('en-AU', 0.123)]
3357->>> p('en-au;q=0.1')
3358-[('en-au', 0.10000000000000001)]
3359->>> p('en-au;q=1.0')
3360-[('en-au', 1.0)]
3361->>> p('da, en-gb;q=0.25, en;q=0.5')
3362-[('da', 1.0), ('en', 0.5), ('en-gb', 0.25)]
3363->>> p('en-au-xx')
3364-[('en-au-xx', 1.0)]
3365->>> p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')
3366-[('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)]
3367->>> p('*')
3368-[('*', 1.0)]
3369->>> p('de;q=0.')
3370-[('de', 1.0)]
3371->>> p('')
3372-[]
3373-
3374-Bad headers; should always return [].
3375->>> p('en-gb;q=1.0000')
3376-[]
3377->>> p('en;q=0.1234')
3378-[]
3379->>> p('en;q=.2')
3380-[]
3381->>> p('abcdefghi-au')
3382-[]
3383->>> p('**')
3384-[]
3385->>> p('en,,gb')
3386-[]
3387->>> p('en-au;q=0.1.0')
3388-[]
3389->>> p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en')
3390-[]
3391->>> p('da, en-gb;q=0.8, en;q=0.7,#')
3392-[]
3393->>> p('de;q=2.0')
3394-[]
3395->>> p('de;q=0.a')
3396-[]
3397->>> p('')
3398-[]
3399-
3400-#
3401-# Now test that we parse a literal HTTP header correctly.
3402-#
3403-
3404->>> from django.utils.translation.trans_real import get_language_from_request
3405->>> g = get_language_from_request
3406->>> from django.http import HttpRequest
3407->>> r = HttpRequest
3408->>> r.COOKIES = {}
3409-
3410-These tests assumes the es, es_AR, pt and pt_BR translations exit in the Django
3411-source tree.
3412->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3413->>> g(r)
3414-'pt-br'
3415->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3416->>> g(r)
3417-'pt'
3418->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3419->>> g(r)
3420-'es'
3421->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3422->>> g(r)
3423-'es-ar'
3424-"""
3425-
3426-# Python 2.3 and 2.4 return slightly different results for completely bogus
3427-# locales, so we omit this test for that anything below 2.4. It's relatively
3428-# harmless in any cases (GIGO). This also means this won't be executed on
3429-# Jython currently, but life's like that sometimes. (On those platforms,
3430-# passing in a truly bogus locale will get you the default locale back.)
3431-if sys.version_info >= (2, 5):
3432-    tests += """
3433-This test assumes there won't be a Django translation to a US variation
3434-of the Spanish language, a safe assumption. When the user sets it
3435-as the preferred language, the main 'es' translation should be selected
3436-instead.
3437->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3438->>> g(r)
3439-'es'
3440-"""
3441-
3442-tests += """
3443-This tests the following scenario: there isn't a main language (zh)
3444-translation of Django but there is a translation to variation (zh_CN)
3445-the user sets zh-cn as the preferred language, it should be selected by
3446-Django without falling back nor ignoring it.
3447->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3448->>> g(r)
3449-'zh-cn'
3450-"""
3451diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
3452index 94e792c..2ab4ce6 100644
3453--- a/tests/regressiontests/i18n/tests.py
3454+++ b/tests/regressiontests/i18n/tests.py
3455@@ -1,72 +1,375 @@
3456-# coding: utf-8
3457-import misc
3458-
3459-regressions = ur"""
3460-Format string interpolation should work with *_lazy objects.
3461-
3462->>> from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3463->>> s = ugettext_lazy('Add %(name)s')
3464->>> d = {'name': 'Ringo'}
3465->>> s % d
3466-u'Add Ringo'
3467->>> activate('de')
3468->>> s % d
3469-u'Ringo hinzuf\xfcgen'
3470->>> activate('pl')
3471->>> s % d
3472-u'Dodaj Ringo'
3473->>> deactivate()
3474-
3475-It should be possible to compare *_lazy objects.
3476-
3477->>> s1 = ugettext_lazy('Add %(name)s')
3478->>> s == s1
3479-True
3480->>> s2 = gettext_lazy('Add %(name)s')
3481->>> s3 = gettext_lazy('Add %(name)s')
3482->>> s2 == s3
3483-True
3484->>> s == s2
3485-True
3486->>> s4 = ugettext_lazy('Some other string')
3487->>> s == s4
3488-False
3489-
3490-unicode(string_concat(...)) should not raise a TypeError - #4796
3491-
3492->>> import django.utils.translation
3493->>> reload(django.utils.translation)
3494-<module 'django.utils.translation' from ...>
3495->>> unicode(django.utils.translation.string_concat("dja", "ngo"))
3496-u'django'
3497-
3498-Translating a string requiring no auto-escaping shouldn't change the "safe"
3499-status.
3500-
3501->>> from django.utils.safestring import mark_safe, SafeString
3502->>> s = mark_safe('Password')
3503->>> type(s)
3504-<class 'django.utils.safestring.SafeString'>
3505->>> activate('de')
3506->>> type(ugettext(s))
3507-<class 'django.utils.safestring.SafeUnicode'>
3508->>> deactivate()
3509-
3510->>> SafeString('a') + s
3511-'aPassword'
3512->>> s + SafeString('a')
3513-'Passworda'
3514->>> s + mark_safe('a')
3515-'Passworda'
3516->>> mark_safe('a') + s
3517-'aPassword'
3518->>> mark_safe('a') + mark_safe('s')
3519-'as'
3520->>> print s
3521-Password
3522-"""
3523-
3524-__test__ = {
3525-    'regressions': regressions,
3526-    'misc': misc.tests,
3527-}
3528+import sys
3529+from django.test import TestCase, client
3530+from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3531+
3532+class TranslationTests(TestCase):
3533+
3534+    def test_lazy_objects(self):
3535+        """
3536+        Format string interpolation should work with *_lazy objects.
3537+        """
3538+        s = ugettext_lazy('Add %(name)s')
3539+        d = {'name': 'Ringo'}
3540+        self.assertEqual(u'Add Ringo', s % d)
3541+        activate('de')
3542+        self.assertEqual(u'Ringo hinzuf\xfcgen', s % d)
3543+        activate('pl')
3544+        self.assertEqual(u'Dodaj Ringo', s % d)
3545+        deactivate()
3546+
3547+        # It should be possible to compare *_lazy objects.
3548+        s1 = ugettext_lazy('Add %(name)s')
3549+        self.assertEqual(True, s == s1)
3550+        s2 = gettext_lazy('Add %(name)s')
3551+        s3 = gettext_lazy('Add %(name)s')
3552+        self.assertEqual(True, s2 == s3)
3553+        self.assertEqual(True, s == s2)
3554+        s4 = ugettext_lazy('Some other string')
3555+        self.assertEqual(False, s == s4)
3556+
3557+    def test_string_concat(self):
3558+        """
3559+        unicode(string_concat(...)) should not raise a TypeError - #4796
3560+        """
3561+        import django.utils.translation
3562+        self.assertEqual(django.utils.translation, reload(django.utils.translation))
3563+        self.assertEqual(u'django', unicode(django.utils.translation.string_concat("dja", "ngo")))
3564+
3565+    def test_safe_status(self):
3566+        """
3567+        Translating a string requiring no auto-escaping shouldn't change the "safe" status.
3568+        """
3569+        from django.utils.safestring import mark_safe, SafeString, SafeUnicode
3570+        s = mark_safe('Password')
3571+        self.assertEqual(SafeString, type(s))
3572+        activate('de')
3573+        self.assertEqual(SafeUnicode, type(ugettext(s)))
3574+        deactivate()
3575+        self.assertEqual('aPassword', SafeString('a') + s)
3576+        self.assertEqual('Passworda', s + SafeString('a'))
3577+        self.assertEqual('Passworda', s + mark_safe('a'))
3578+        self.assertEqual('aPassword', mark_safe('a') + s)
3579+        self.assertEqual('as', mark_safe('a') + mark_safe('s'))
3580+        #self.assertEqual(Password, print s)
3581+
3582+    def test_maclines(self):
3583+        """
3584+        Translations on files with mac or dos end of lines will be converted
3585+        to unix eof in .po catalogs, and they have to match when retrieved
3586+        """
3587+        from django.utils.translation.trans_real import translation
3588+        ca_translation = translation('ca')
3589+        ca_translation._catalog[u'Mac\nEOF\n'] = u'Catalan Mac\nEOF\n'
3590+        ca_translation._catalog[u'Win\nEOF\n'] = u'Catalan Win\nEOF\n'
3591+        activate('ca')
3592+        self.assertEqual(u'Catalan Mac\nEOF\n', ugettext(u'Mac\rEOF\r'))
3593+        self.assertEqual(u'Catalan Win\nEOF\n', ugettext(u'Win\r\nEOF\r\n'))
3594+        deactivate()
3595+
3596+    def test_dates_and_numbers(self):
3597+        """
3598+        Localization of dates and numbers
3599+        """
3600+        import datetime
3601+        import decimal
3602+        from django.conf import settings
3603+        from django.utils.formats import getformat, date_format, number_format, localize
3604+        from django.utils.numberformat import format
3605+        from django import template, forms
3606+        from django.forms.extras import SelectDateWidget
3607+
3608+        old_use_i18n = settings.USE_I18N
3609+        old_use_format_i18n = settings.USE_FORMAT_I18N
3610+        old_use_thousand_separator = settings.USE_THOUSAND_SEPARATOR
3611+
3612+        n = decimal.Decimal('66666.666')
3613+        f = 99999.999
3614+        d = datetime.date(2009, 12, 31)
3615+        dt = datetime.datetime(2009, 12, 31, 20, 50)
3616+        ctxt = template.Context({'n': n, 'd': d, 'dt': dt, 'f': f})
3617+
3618+        # Locale independent
3619+
3620+        class I18nForm(forms.Form):
3621+            decimal_field = forms.DecimalField()
3622+            float_field = forms.FloatField()
3623+            date_field = forms.DateField()
3624+            datetime_field = forms.DateTimeField()
3625+            time_field = forms.TimeField()
3626+
3627+        class SelectDateForm(forms.Form):
3628+            date_field = forms.DateField(widget=SelectDateWidget)
3629+
3630+        settings.USE_FORMAT_I18N = True
3631+        settings.USE_THOUSAND_SEPARATOR = False
3632+        self.assertEqual(u'66666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3633+        self.assertEqual(u'66666A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3634+
3635+        settings.USE_THOUSAND_SEPARATOR = True
3636+        self.assertEqual(u'66,666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3637+        self.assertEqual(u'6B6B6B6B6A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3638+        self.assertEqual(u'-66666.6', format(-66666.666, decimal_sep='.', decimal_pos=1))
3639+        self.assertEqual(u'-66666.0', format(int('-66666'), decimal_sep='.', decimal_pos=1))
3640+
3641+        # Catalan locale with format i18n disabled translations will be used, but not formats
3642+
3643+        settings.USE_FORMAT_I18N = False
3644+        activate('ca')
3645+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3646+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3647+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3648+        self.assertEqual(u'des. 31, 2009', date_format(d))
3649+        self.assertEqual(u'desembre 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3650+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3651+        self.assertEqual('No localizable', localize('No localizable'))
3652+        self.assertEqual(decimal.Decimal('66666.666'), localize(n))
3653+        self.assertEqual(99999.999, localize(f))
3654+        self.assertEqual(datetime.date(2009, 12, 31), localize(d))
3655+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), localize(dt))
3656+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3657+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3658+        self.assertEqual(u'2009-12-31', template.Template('{{ d }}').render(ctxt))
3659+        self.assertEqual(u'2009-12-31 20:50:00', template.Template('{{ dt }}').render(ctxt))
3660+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3661+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3662+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3663+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3664+
3665+        form = I18nForm({
3666+            'decimal_field': u'66666,666',
3667+            'float_field': u'99999,999',
3668+            'date_field': u'31/12/2009',
3669+            'datetime_field': u'31/12/2009 20:50',
3670+            'time_field': u'20:50'
3671+        })
3672+        self.assertEqual(False, form.is_valid())
3673+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['float_field'])
3674+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
3675+        self.assertEqual([u'Introdu\xefu una data v\xe0lida.'], form.errors['date_field'])
3676+        self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
3677+
3678+        form2 = SelectDateForm({
3679+            'date_field_month': u'12',
3680+            'date_field_day': u'31',
3681+            'date_field_year': u'2009'
3682+        })
3683+        self.assertEqual(True, form2.is_valid())
3684+        self.assertEqual(datetime.date(2009, 12, 31), form2.cleaned_data['date_field'])
3685+        self.assertEqual(u'<select name="mydate_month" id="id_mydate_month">\n<option value="1">gener</option>\n<option value="2">febrer</option>\n<option value="3">mar\xe7</option>\n<option value="4">abril</option>\n<option value="5">maig</option>\n<option value="6">juny</option>\n<option value="7">juliol</option>\n<option value="8">agost</option>\n<option value="9">setembre</option>\n<option value="10">octubre</option>\n<option value="11">novembre</option>\n<option value="12" selected="selected">desembre</option>\n</select>\n<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>', SelectDateWidget().render('mydate', datetime.date(2009, 12, 31)))
3686+        deactivate()
3687+
3688+        # Catalan locale
3689+
3690+        settings.USE_FORMAT_I18N = True
3691+        activate('ca')
3692+        self.assertEqual('j \de F \de Y', getformat('DATE_FORMAT'))
3693+        self.assertEqual(1, getformat('FIRST_DAY_OF_WEEK'))
3694+        self.assertEqual(',', getformat('DECIMAL_SEPARATOR'))
3695+        self.assertEqual(u'31 de desembre de 2009', date_format(d))
3696+        self.assertEqual(u'desembre del 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3697+        self.assertEqual(u'31/12/2009 20:50', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3698+        self.assertEqual('No localizable', localize('No localizable'))
3699+
3700+        settings.USE_THOUSAND_SEPARATOR = True
3701+        self.assertEqual(u'66.666,666', localize(n))
3702+        self.assertEqual(u'99.999,999', localize(f))
3703+
3704+        settings.USE_THOUSAND_SEPARATOR = False
3705+        self.assertEqual(u'66666,666', localize(n))
3706+        self.assertEqual(u'99999,999', localize(f))
3707+        self.assertEqual(u'31 de desembre de 2009', localize(d))
3708+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', localize(dt))
3709+
3710+        settings.USE_THOUSAND_SEPARATOR = True
3711+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
3712+        self.assertEqual(u'99.999,999', template.Template('{{ f }}').render(ctxt))
3713+
3714+        settings.USE_THOUSAND_SEPARATOR = False
3715+        self.assertEqual(u'66666,666', template.Template('{{ n }}').render(ctxt))
3716+        self.assertEqual(u'99999,999', template.Template('{{ f }}').render(ctxt))
3717+        self.assertEqual(u'31 de desembre de 2009', template.Template('{{ d }}').render(ctxt))
3718+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', template.Template('{{ dt }}').render(ctxt))
3719+        self.assertEqual(u'66666,67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3720+        self.assertEqual(u'100000,0', template.Template('{{ f|floatformat }}').render(ctxt))
3721+        self.assertEqual(u'31/12/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3722+        self.assertEqual(u'31/12/2009 20:50', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3723+
3724+        form3 = I18nForm({
3725+            'decimal_field': u'66666,666',
3726+            'float_field': u'99999,999',
3727+            'date_field': u'31/12/2009',
3728+            'datetime_field': u'31/12/2009 20:50',
3729+            'time_field': u'20:50'
3730+        })
3731+        self.assertEqual(True, form3.is_valid())
3732+        self.assertEqual(decimal.Decimal('66666.666'), form3.cleaned_data['decimal_field'])
3733+        self.assertEqual(99999.999, form3.cleaned_data['float_field'])
3734+        self.assertEqual(datetime.date(2009, 12, 31), form3.cleaned_data['date_field'])
3735+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form3.cleaned_data['datetime_field'])
3736+        self.assertEqual(datetime.time(20, 50), form3.cleaned_data['time_field'])
3737+
3738+        form4 = SelectDateForm({
3739+            'date_field_month': u'12',
3740+            'date_field_day': u'31',
3741+            'date_field_year': u'2009'
3742+        })
3743+        self.assertEqual(True, form4.is_valid())
3744+        self.assertEqual(datetime.date(2009, 12, 31), form4.cleaned_data['date_field'])
3745+        self.assertEqual(u'<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_month" id="id_mydate_month">\n<option value="1">gener</option>\n<option value="2">febrer</option>\n<option value="3">mar\xe7</option>\n<option value="4">abril</option>\n<option value="5">maig</option>\n<option value="6">juny</option>\n<option value="7">juliol</option>\n<option value="8">agost</option>\n<option value="9">setembre</option>\n<option value="10">octubre</option>\n<option value="11">novembre</option>\n<option value="12" selected="selected">desembre</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>', SelectDateWidget().render('mydate', datetime.date(2009, 12, 31)))
3746+        deactivate()
3747+
3748+        # English locale
3749+
3750+        settings.USE_FORMAT_I18N = True
3751+        activate('en')
3752+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3753+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3754+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3755+        self.assertEqual(u'Dec. 31, 2009', date_format(d))
3756+        self.assertEqual(u'December 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3757+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3758+        self.assertEqual('No localizable', localize('No localizable'))
3759+
3760+        settings.USE_THOUSAND_SEPARATOR = True
3761+        self.assertEqual(u'66,666.666', localize(n))
3762+        self.assertEqual(u'99,999.999', localize(f))
3763+
3764+        settings.USE_THOUSAND_SEPARATOR = False
3765+        self.assertEqual(u'66666.666', localize(n))
3766+        self.assertEqual(u'99999.999', localize(f))
3767+        self.assertEqual(u'Dec. 31, 2009', localize(d))
3768+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', localize(dt))
3769+
3770+        settings.USE_THOUSAND_SEPARATOR = True
3771+        self.assertEqual(u'66,666.666', template.Template('{{ n }}').render(ctxt))
3772+        self.assertEqual(u'99,999.999', template.Template('{{ f }}').render(ctxt))
3773+
3774+        settings.USE_THOUSAND_SEPARATOR = False
3775+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3776+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3777+        self.assertEqual(u'Dec. 31, 2009', template.Template('{{ d }}').render(ctxt))
3778+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', template.Template('{{ dt }}').render(ctxt))
3779+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3780+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3781+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3782+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3783+
3784+        form5 = I18nForm({
3785+            'decimal_field': u'66666.666',
3786+            'float_field': u'99999.999',
3787+            'date_field': u'12/31/2009',
3788+            'datetime_field': u'12/31/2009 20:50',
3789+            'time_field': u'20:50'
3790+        })
3791+        self.assertEqual(True, form5.is_valid())
3792+        self.assertEqual(decimal.Decimal('66666.666'), form5.cleaned_data['decimal_field'])
3793+        self.assertEqual(99999.999, form5.cleaned_data['float_field'])
3794+        self.assertEqual(datetime.date(2009, 12, 31), form5.cleaned_data['date_field'])
3795+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form5.cleaned_data['datetime_field'])
3796+        self.assertEqual(datetime.time(20, 50), form5.cleaned_data['time_field'])
3797+
3798+        form6 = SelectDateForm({
3799+            'date_field_month': u'12',
3800+            'date_field_day': u'31',
3801+            'date_field_year': u'2009'
3802+        })
3803+        self.assertEqual(True, form6.is_valid())
3804+        self.assertEqual(datetime.date(2009, 12, 31), form6.cleaned_data['date_field'])
3805+        self.assertEqual(u'<select name="mydate_month" id="id_mydate_month">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12" selected="selected">December</option>\n</select>\n<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>', SelectDateWidget().render('mydate', datetime.date(2009, 12, 31)))
3806+        deactivate()
3807+
3808+        # Check if sublocales fall back to the main locale
3809+        activate('de-at')
3810+        settings.USE_THOUSAND_SEPARATOR = True
3811+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
3812+        deactivate()
3813+
3814+        activate('es-ar')
3815+        self.assertEqual(u'31 de Diciembre de 2009', date_format(d))
3816+        deactivate()
3817+
3818+        # Restore defaults
3819+        settings.USE_I18N = old_use_i18n
3820+        settings.USE_FORMAT_I18N = old_use_format_i18n
3821+        settings.USE_THOUSAND_SEPARATOR = old_use_thousand_separator
3822+
3823+
3824+class MiscTests(TestCase):
3825+
3826+    def test_parse_spec_http_header(self):
3827+        """
3828+        Testing HTTP header parsing. First, we test that we can parse the
3829+        values according to the spec (and that we extract all the pieces in
3830+        the right order).
3831+        """
3832+        from django.utils.translation.trans_real import parse_accept_lang_header
3833+        p = parse_accept_lang_header
3834+        # Good headers.
3835+        self.assertEqual([('de', 1.0)], p('de'))
3836+        self.assertEqual([('en-AU', 1.0)], p('en-AU'))
3837+        self.assertEqual([('*', 1.0)], p('*;q=1.00'))
3838+        self.assertEqual([('en-AU', 0.123)], p('en-AU;q=0.123'))
3839+        self.assertEqual([('en-au', 0.10000000000000001)], p('en-au;q=0.1'))
3840+        self.assertEqual([('en-au', 1.0)], p('en-au;q=1.0'))
3841+        self.assertEqual([('da', 1.0), ('en', 0.5), ('en-gb', 0.25)], p('da, en-gb;q=0.25, en;q=0.5'))
3842+        self.assertEqual([('en-au-xx', 1.0)], p('en-au-xx'))
3843+        self.assertEqual([('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)], p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125'))
3844+        self.assertEqual([('*', 1.0)], p('*'))
3845+        self.assertEqual([('de', 1.0)], p('de;q=0.'))
3846+        self.assertEqual([], p(''))
3847+
3848+        # Bad headers; should always return [].
3849+        self.assertEqual([], p('en-gb;q=1.0000'))
3850+        self.assertEqual([], p('en;q=0.1234'))
3851+        self.assertEqual([], p('en;q=.2'))
3852+        self.assertEqual([], p('abcdefghi-au'))
3853+        self.assertEqual([], p('**'))
3854+        self.assertEqual([], p('en,,gb'))
3855+        self.assertEqual([], p('en-au;q=0.1.0'))
3856+        self.assertEqual([], p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en'))
3857+        self.assertEqual([], p('da, en-gb;q=0.8, en;q=0.7,#'))
3858+        self.assertEqual([], p('de;q=2.0'))
3859+        self.assertEqual([], p('de;q=0.a'))
3860+        self.assertEqual([], p(''))
3861+
3862+    def test_parse_literal_http_header(self):
3863+        """
3864+        Now test that we parse a literal HTTP header correctly.
3865+        """
3866+        from django.utils.translation.trans_real import get_language_from_request
3867+        g = get_language_from_request
3868+        from django.http import HttpRequest
3869+        r = HttpRequest
3870+        r.COOKIES = {}
3871+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3872+        self.assertEqual('pt-br', g(r))
3873+
3874+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3875+        self.assertEqual('pt', g(r))
3876+
3877+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3878+        self.assertEqual('es', g(r))
3879+
3880+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3881+        self.assertEqual('es-ar', g(r))
3882+
3883+        # Python 2.3 and 2.4 return slightly different results for completely
3884+        # bogus locales, so we omit this test for that anything below 2.4.
3885+        # It's relatively harmless in any cases (GIGO). This also means this
3886+        # won't be executed on Jython currently, but life's like that
3887+        # sometimes. (On those platforms, passing in a truly bogus locale
3888+        # will get you the default locale back.)
3889+        if sys.version_info >= (2, 5):
3890+            # This test assumes there won't be a Django translation to a US
3891+            # variation of the Spanish language, a safe assumption. When the
3892+            # user sets it as the preferred language, the main 'es'
3893+            # translation should be selected instead.
3894+            r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3895+            self.assertEqual(g(r), 'es')
3896+
3897+        # This tests the following scenario: there isn't a main language (zh)
3898+        # translation of Django but there is a translation to variation (zh_CN)
3899+        # the user sets zh-cn as the preferred language, it should be selected
3900+        # by Django without falling back nor ignoring it.
3901+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3902+        self.assertEqual(g(r), 'zh-cn')