Code

Ticket #7980: i18n-formatting.2.diff

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

Fixed issue with LANGUAGE_CODE of sublanguages

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..b1aaa77
1424--- /dev/null
1425+++ b/django/conf/locale/sr/formats.py
1426@@ -0,0 +1,18 @@
1427+# -*- encoding: utf-8 -*-
1428+# This file is distributed under the same license as the Django package.
1429+#
1430+
1431+DATE_FORMAT = 'd. F Y.'
1432+TIME_FORMAT = 'H.i.s'
1433+# DATETIME_FORMAT =
1434+YEAR_MONTH_FORMAT = 'Y F'
1435+MONTH_DAY_FORMAT = 'F j.'
1436+SHORT_DATE_FORMAT = 'd.m.Y.'
1437+# SHORT_DATETIME_FORMAT =
1438+# FIRST_DAY_OF_WEEK =
1439+# DATE_INPUT_FORMATS =
1440+# TIME_INPUT_FORMATS =
1441+# DATETIME_INPUT_FORMATS =
1442+DECIMAL_SEPARATOR = '.'
1443+THOUSAND_SEPARATOR = ','
1444+# NUMBER_GROUPING =
1445diff --git a/django/conf/locale/sr_Latn/__init__.py b/django/conf/locale/sr_Latn/__init__.py
1446new file mode 100644
1447index 0000000..e69de29
1448diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py
1449new file mode 100644
1450index 0000000..6d71786
1451--- /dev/null
1452+++ b/django/conf/locale/sr_Latn/formats.py
1453@@ -0,0 +1,18 @@
1454+# -*- encoding: utf-8 -*-
1455+# This file is distributed under the same license as the Django package.
1456+#
1457+
1458+# DATE_FORMAT =
1459+# TIME_FORMAT =
1460+# DATETIME_FORMAT =
1461+# YEAR_MONTH_FORMAT =
1462+# MONTH_DAY_FORMAT =
1463+# SHORT_DATE_FORMAT =
1464+# SHORT_DATETIME_FORMAT =
1465+# FIRST_DAY_OF_WEEK =
1466+# DATE_INPUT_FORMATS =
1467+# TIME_INPUT_FORMATS =
1468+# DATETIME_INPUT_FORMATS =
1469+# DECIMAL_SEPARATOR =
1470+# THOUSAND_SEPARATOR =
1471+# NUMBER_GROUPING =
1472diff --git a/django/conf/locale/sv/__init__.py b/django/conf/locale/sv/__init__.py
1473new file mode 100644
1474index 0000000..e69de29
1475diff --git a/django/conf/locale/sv/formats.py b/django/conf/locale/sv/formats.py
1476new file mode 100644
1477index 0000000..df4e633
1478--- /dev/null
1479+++ b/django/conf/locale/sv/formats.py
1480@@ -0,0 +1,18 @@
1481+# -*- encoding: utf-8 -*-
1482+# This file is distributed under the same license as the Django package.
1483+#
1484+
1485+DATE_FORMAT = 'j F Y'
1486+TIME_FORMAT = 'H.i.s'
1487+# DATETIME_FORMAT =
1488+YEAR_MONTH_FORMAT = 'Y F'
1489+MONTH_DAY_FORMAT = 'j F'
1490+SHORT_DATE_FORMAT = 'j M Y'
1491+# SHORT_DATETIME_FORMAT =
1492+# FIRST_DAY_OF_WEEK =
1493+# DATE_INPUT_FORMATS =
1494+# TIME_INPUT_FORMATS =
1495+# DATETIME_INPUT_FORMATS =
1496+DECIMAL_SEPARATOR = ','
1497+THOUSAND_SEPARATOR = ' '
1498+# NUMBER_GROUPING =
1499diff --git a/django/conf/locale/ta/__init__.py b/django/conf/locale/ta/__init__.py
1500new file mode 100644
1501index 0000000..e69de29
1502diff --git a/django/conf/locale/ta/formats.py b/django/conf/locale/ta/formats.py
1503new file mode 100644
1504index 0000000..69fa17d
1505--- /dev/null
1506+++ b/django/conf/locale/ta/formats.py
1507@@ -0,0 +1,18 @@
1508+# -*- encoding: utf-8 -*-
1509+# This file is distributed under the same license as the Django package.
1510+#
1511+
1512+DATE_FORMAT = 'j F, Y'
1513+TIME_FORMAT = 'g:i:s A'
1514+# DATETIME_FORMAT =
1515+# YEAR_MONTH_FORMAT =
1516+MONTH_DAY_FORMAT = 'j F'
1517+SHORT_DATE_FORMAT = 'j M, Y'
1518+# SHORT_DATETIME_FORMAT =
1519+# FIRST_DAY_OF_WEEK =
1520+# DATE_INPUT_FORMATS =
1521+# TIME_INPUT_FORMATS =
1522+# DATETIME_INPUT_FORMATS =
1523+# DECIMAL_SEPARATOR =
1524+# THOUSAND_SEPARATOR =
1525+# NUMBER_GROUPING =
1526diff --git a/django/conf/locale/te/__init__.py b/django/conf/locale/te/__init__.py
1527new file mode 100644
1528index 0000000..e69de29
1529diff --git a/django/conf/locale/te/formats.py b/django/conf/locale/te/formats.py
1530new file mode 100644
1531index 0000000..e805872
1532--- /dev/null
1533+++ b/django/conf/locale/te/formats.py
1534@@ -0,0 +1,18 @@
1535+# -*- encoding: utf-8 -*-
1536+# This file is distributed under the same license as the Django package.
1537+#
1538+
1539+DATE_FORMAT = 'j F Y'
1540+TIME_FORMAT = 'g:i:s A'
1541+# DATETIME_FORMAT =
1542+# YEAR_MONTH_FORMAT =
1543+MONTH_DAY_FORMAT = 'j F'
1544+SHORT_DATE_FORMAT = 'j M Y'
1545+# SHORT_DATETIME_FORMAT =
1546+# FIRST_DAY_OF_WEEK =
1547+# DATE_INPUT_FORMATS =
1548+# TIME_INPUT_FORMATS =
1549+# DATETIME_INPUT_FORMATS =
1550+# DECIMAL_SEPARATOR =
1551+# THOUSAND_SEPARATOR =
1552+# NUMBER_GROUPING =
1553diff --git a/django/conf/locale/th/__init__.py b/django/conf/locale/th/__init__.py
1554new file mode 100644
1555index 0000000..e69de29
1556diff --git a/django/conf/locale/th/formats.py b/django/conf/locale/th/formats.py
1557new file mode 100644
1558index 0000000..7091dc6
1559--- /dev/null
1560+++ b/django/conf/locale/th/formats.py
1561@@ -0,0 +1,18 @@
1562+# -*- encoding: utf-8 -*-
1563+# This file is distributed under the same license as the Django package.
1564+#
1565+
1566+DATE_FORMAT = 'j F Y'
1567+TIME_FORMAT = 'G:i:s'
1568+DATETIME_FORMAT = 'j F Y, G:i:s'
1569+YEAR_MONTH_FORMAT = 'F Y'
1570+MONTH_DAY_FORMAT = 'j F'
1571+SHORT_DATE_FORMAT = 'j M Y'
1572+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
1573+# FIRST_DAY_OF_WEEK =
1574+# DATE_INPUT_FORMATS =
1575+# TIME_INPUT_FORMATS =
1576+# DATETIME_INPUT_FORMATS =
1577+DECIMAL_SEPARATOR = '.'
1578+THOUSAND_SEPARATOR = ','
1579+# NUMBER_GROUPING =
1580diff --git a/django/conf/locale/tr/__init__.py b/django/conf/locale/tr/__init__.py
1581new file mode 100644
1582index 0000000..e69de29
1583diff --git a/django/conf/locale/tr/formats.py b/django/conf/locale/tr/formats.py
1584new file mode 100644
1585index 0000000..b978788
1586--- /dev/null
1587+++ b/django/conf/locale/tr/formats.py
1588@@ -0,0 +1,18 @@
1589+# -*- encoding: utf-8 -*-
1590+# This file is distributed under the same license as the Django package.
1591+#
1592+
1593+DATE_FORMAT = 'd F Y'
1594+TIME_FORMAT = 'H:i:s'
1595+# DATETIME_FORMAT =
1596+YEAR_MONTH_FORMAT = 'F Y'
1597+MONTH_DAY_FORMAT = 'd F'
1598+SHORT_DATE_FORMAT = 'd M Y'
1599+# SHORT_DATETIME_FORMAT =
1600+# FIRST_DAY_OF_WEEK =
1601+# DATE_INPUT_FORMATS =
1602+# TIME_INPUT_FORMATS =
1603+# DATETIME_INPUT_FORMATS =
1604+DECIMAL_SEPARATOR = ','
1605+THOUSAND_SEPARATOR = '.'
1606+# NUMBER_GROUPING =
1607diff --git a/django/conf/locale/uk/__init__.py b/django/conf/locale/uk/__init__.py
1608new file mode 100644
1609index 0000000..e69de29
1610diff --git a/django/conf/locale/uk/formats.py b/django/conf/locale/uk/formats.py
1611new file mode 100644
1612index 0000000..8e41bf0
1613--- /dev/null
1614+++ b/django/conf/locale/uk/formats.py
1615@@ -0,0 +1,18 @@
1616+# -*- encoding: utf-8 -*-
1617+# This file is distributed under the same license as the Django package.
1618+#
1619+
1620+DATE_FORMAT = 'j F Y р.'
1621+TIME_FORMAT = 'H:i:s'
1622+# DATETIME_FORMAT =
1623+YEAR_MONTH_FORMAT = 'F Y'
1624+MONTH_DAY_FORMAT = 'j F'
1625+SHORT_DATE_FORMAT = 'j M Y'
1626+# SHORT_DATETIME_FORMAT =
1627+# FIRST_DAY_OF_WEEK =
1628+# DATE_INPUT_FORMATS =
1629+# TIME_INPUT_FORMATS =
1630+# DATETIME_INPUT_FORMATS =
1631+DECIMAL_SEPARATOR = ','
1632+THOUSAND_SEPARATOR = ' '
1633+# NUMBER_GROUPING =
1634diff --git a/django/conf/locale/zh_CN/__init__.py b/django/conf/locale/zh_CN/__init__.py
1635new file mode 100644
1636index 0000000..e69de29
1637diff --git a/django/conf/locale/zh_CN/formats.py b/django/conf/locale/zh_CN/formats.py
1638new file mode 100644
1639index 0000000..6d71786
1640--- /dev/null
1641+++ b/django/conf/locale/zh_CN/formats.py
1642@@ -0,0 +1,18 @@
1643+# -*- encoding: utf-8 -*-
1644+# This file is distributed under the same license as the Django package.
1645+#
1646+
1647+# DATE_FORMAT =
1648+# TIME_FORMAT =
1649+# DATETIME_FORMAT =
1650+# YEAR_MONTH_FORMAT =
1651+# MONTH_DAY_FORMAT =
1652+# SHORT_DATE_FORMAT =
1653+# SHORT_DATETIME_FORMAT =
1654+# FIRST_DAY_OF_WEEK =
1655+# DATE_INPUT_FORMATS =
1656+# TIME_INPUT_FORMATS =
1657+# DATETIME_INPUT_FORMATS =
1658+# DECIMAL_SEPARATOR =
1659+# THOUSAND_SEPARATOR =
1660+# NUMBER_GROUPING =
1661diff --git a/django/conf/locale/zh_TW/__init__.py b/django/conf/locale/zh_TW/__init__.py
1662new file mode 100644
1663index 0000000..e69de29
1664diff --git a/django/conf/locale/zh_TW/formats.py b/django/conf/locale/zh_TW/formats.py
1665new file mode 100644
1666index 0000000..6d71786
1667--- /dev/null
1668+++ b/django/conf/locale/zh_TW/formats.py
1669@@ -0,0 +1,18 @@
1670+# -*- encoding: utf-8 -*-
1671+# This file is distributed under the same license as the Django package.
1672+#
1673+
1674+# DATE_FORMAT =
1675+# TIME_FORMAT =
1676+# DATETIME_FORMAT =
1677+# YEAR_MONTH_FORMAT =
1678+# MONTH_DAY_FORMAT =
1679+# SHORT_DATE_FORMAT =
1680+# SHORT_DATETIME_FORMAT =
1681+# FIRST_DAY_OF_WEEK =
1682+# DATE_INPUT_FORMATS =
1683+# TIME_INPUT_FORMATS =
1684+# DATETIME_INPUT_FORMATS =
1685+# DECIMAL_SEPARATOR =
1686+# THOUSAND_SEPARATOR =
1687+# NUMBER_GROUPING =
1688diff --git a/django/contrib/admin/media/js/calendar.js b/django/contrib/admin/media/js/calendar.js
1689index 9035176..3f57145 100644
1690--- a/django/contrib/admin/media/js/calendar.js
1691+++ b/django/contrib/admin/media/js/calendar.js
1692@@ -25,6 +25,7 @@ function quickElement() {
1693 var CalendarNamespace = {
1694     monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
1695     daysOfWeek: gettext('S M T W T F S').split(' '),
1696+    firstDayOfWeek: parseInt(gettext('FIRST_DAY_OF_WEEK')),
1697     isLeapYear: function(year) {
1698         return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
1699     },
1700@@ -56,10 +57,10 @@ var CalendarNamespace = {
1701         // Draw days-of-week header
1702         var tableRow = quickElement('tr', tableBody);
1703         for (var i = 0; i < 7; i++) {
1704-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]);
1705+            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
1706         }
1707 
1708-        var startingPos = new Date(year, month-1, 1).getDay();
1709+        var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
1710         var days = CalendarNamespace.getDaysInMonth(month, year);
1711 
1712         // Draw blanks before first of month
1713diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
1714index 38b1c34..9e6223a 100644
1715--- a/django/contrib/admin/templates/admin/object_history.html
1716+++ b/django/contrib/admin/templates/admin/object_history.html
1717@@ -27,7 +27,7 @@
1718         <tbody>
1719         {% for action in action_list %}
1720         <tr>
1721-            <th scope="row">{{ action.action_time|date:_("DATETIME_FORMAT") }}</th>
1722+            <th scope="row">{{ action.action_time|date }}</th>
1723             <td>{{ action.user.username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}</td>
1724             <td>{{ action.change_message }}</td>
1725         </tr>
1726diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
1727index 5a02ab0..cd05957 100644
1728--- a/django/contrib/admin/templatetags/admin_list.py
1729+++ b/django/contrib/admin/templatetags/admin_list.py
1730@@ -3,11 +3,11 @@ from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
1731 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
1732 from django.core.exceptions import ObjectDoesNotExist
1733 from django.db import models
1734-from django.utils import dateformat
1735+from django.utils import formats
1736 from django.utils.html import escape, conditional_escape
1737 from django.utils.text import capfirst
1738 from django.utils.safestring import mark_safe
1739-from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
1740+from django.utils.translation import ugettext as _
1741 from django.utils.encoding import smart_unicode, smart_str, force_unicode
1742 from django.template import Library
1743 import datetime
1744@@ -189,25 +189,24 @@ def items_for_result(cl, result, form):
1745             # Dates and times are special: They're formatted in a certain way.
1746             elif isinstance(f, models.DateField) or isinstance(f, models.TimeField):
1747                 if field_val:
1748-                    (date_format, datetime_format, time_format) = get_date_formats()
1749-                    if isinstance(f, models.DateTimeField):
1750-                        result_repr = capfirst(dateformat.format(field_val, datetime_format))
1751-                    elif isinstance(f, models.TimeField):
1752-                        result_repr = capfirst(dateformat.time_format(field_val, time_format))
1753-                    else:
1754-                        result_repr = capfirst(dateformat.format(field_val, date_format))
1755+                    result_repr = formats.localize(field_val)
1756+                else:
1757+                    result_repr = EMPTY_CHANGELIST_VALUE
1758+            elif isinstance(f, models.DecimalField):
1759+                if field_val:
1760+                    result_repr = formats.number_format(field_val, f.decimal_places)
1761+                else:
1762+                    result_repr = EMPTY_CHANGELIST_VALUE
1763+                row_class = ' class="nowrap"'
1764+            elif isinstance(f, models.FloatField):
1765+                if field_val:
1766+                    result_repr = formats.number_format(field_val)
1767                 else:
1768                     result_repr = EMPTY_CHANGELIST_VALUE
1769                 row_class = ' class="nowrap"'
1770             # Booleans are special: We use images.
1771             elif isinstance(f, models.BooleanField) or isinstance(f, models.NullBooleanField):
1772                 result_repr = _boolean_icon(field_val)
1773-            # DecimalFields are special: Zero-pad the decimals.
1774-            elif isinstance(f, models.DecimalField):
1775-                if field_val is not None:
1776-                    result_repr = ('%%.%sf' % f.decimal_places) % field_val
1777-                else:
1778-                    result_repr = EMPTY_CHANGELIST_VALUE
1779             # Fields with choices are special: Use the representation
1780             # of the choice.
1781             elif f.flatchoices:
1782@@ -268,7 +267,6 @@ def date_hierarchy(cl):
1783         year_lookup = cl.params.get(year_field)
1784         month_lookup = cl.params.get(month_field)
1785         day_lookup = cl.params.get(day_field)
1786-        year_month_format, month_day_format = get_partial_date_formats()
1787 
1788         link = lambda d: cl.get_query_string(d, [field_generic])
1789 
1790@@ -278,9 +276,9 @@ def date_hierarchy(cl):
1791                 'show': True,
1792                 'back': {
1793                     'link': link({year_field: year_lookup, month_field: month_lookup}),
1794-                    'title': dateformat.format(day, year_month_format)
1795+                    'title': capfirst(formats.date_format(day, 'YEAR_MONTH_FORMAT'))
1796                 },
1797-                'choices': [{'title': dateformat.format(day, month_day_format)}]
1798+                'choices': [{'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))}]
1799             }
1800         elif year_lookup and month_lookup:
1801             days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')
1802@@ -292,7 +290,7 @@ def date_hierarchy(cl):
1803                 },
1804                 'choices': [{
1805                     'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),
1806-                    'title': dateformat.format(day, month_day_format)
1807+                    'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))
1808                 } for day in days]
1809             }
1810         elif year_lookup:
1811@@ -305,7 +303,7 @@ def date_hierarchy(cl):
1812                 },
1813                 'choices': [{
1814                     'link': link({year_field: year_lookup, month_field: month.month}),
1815-                    'title': dateformat.format(month, year_month_format)
1816+                    'title': capfirst(formats.date_format(month, 'YEAR_MONTH_FORMAT'))
1817                 } for month in months]
1818             }
1819         else:
1820diff --git a/django/contrib/databrowse/datastructures.py b/django/contrib/databrowse/datastructures.py
1821index 5fdbdbe..369f825 100644
1822--- a/django/contrib/databrowse/datastructures.py
1823+++ b/django/contrib/databrowse/datastructures.py
1824@@ -4,9 +4,8 @@ convenience functionality and permalink functions for the databrowse app.
1825 """
1826 
1827 from django.db import models
1828-from django.utils import dateformat
1829+from django.utils import formats
1830 from django.utils.text import capfirst
1831-from django.utils.translation import get_date_formats
1832 from django.utils.encoding import smart_unicode, smart_str, iri_to_uri
1833 from django.utils.safestring import mark_safe
1834 from django.db.models.query import QuerySet
1835@@ -156,13 +155,12 @@ class EasyInstanceField(object):
1836             objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
1837         elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
1838             if self.raw_value:
1839-                date_format, datetime_format, time_format = get_date_formats()
1840                 if isinstance(self.field, models.DateTimeField):
1841-                    objs = capfirst(dateformat.format(self.raw_value, datetime_format))
1842+                    objs = capfirst(formats.date_format(self.raw_value, 'DATETIME_FORMAT'))
1843                 elif isinstance(self.field, models.TimeField):
1844-                    objs = capfirst(dateformat.time_format(self.raw_value, time_format))
1845+                    objs = capfirst(formats.date_format(self.raw_value, 'TIME_FORMAT'))
1846                 else:
1847-                    objs = capfirst(dateformat.format(self.raw_value, date_format))
1848+                    objs = capfirst(formats.date_format(self.raw_value, 'DATE_FORMAT'))
1849             else:
1850                 objs = EMPTY_VALUE
1851         elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
1852diff --git a/django/core/management/commands/importcldr.py b/django/core/management/commands/importcldr.py
1853new file mode 100644
1854index 0000000..c4a13e6
1855--- /dev/null
1856+++ b/django/core/management/commands/importcldr.py
1857@@ -0,0 +1,221 @@
1858+import sys
1859+import os
1860+import re
1861+from optparse import make_option, OptionParser
1862+
1863+from django.core.management.base import LabelCommand, CommandError
1864+
1865+try:
1866+    from lxml import etree
1867+except ImportError:
1868+    raise CommandError('You need to install `python-lxml` to run this script')
1869+
1870+FORMATS_FILE_NAME = 'formats.py'
1871+FORMATS_FILE_HEADER = '''# -*- encoding: utf-8 -*-
1872+# This file is distributed under the same license as the Django package.
1873+#
1874+
1875+'''
1876+
1877+def quote(nodes, name,  locale, previous):
1878+    if len(nodes):
1879+        return "'%s'" % unicode(nodes[0].text).replace("'", "\\'")
1880+    else:
1881+        return None
1882+
1883+def convert_time(nodes, name,  locale, previous):
1884+    SPECIAL_CHARS = ('a', 'A', 'b', 'B', 'd', 'D', 'f', 'F', 'g', 'G', 'h',
1885+        'H', 'i', 'I', 'j', 'l', 'L', 'm', 'M', 'n', 'N', 'O', 'P', 'r',
1886+        's', 'S', 't', 'T', 'U', 'w', 'W', 'y', 'Y', 'z', 'Z')
1887+    FORMAT_STR_MAP = ( # not using a dict, because we have to apply formats in order
1888+        ('dd', 'd'),
1889+        ('d', 'j'),
1890+        ('MMMM', 'F'),
1891+        ('MMM', 'M'),
1892+        ('MM', 'm'),
1893+        ('M', 'n'),
1894+        ('yyyy', 'Y'),
1895+        ('yy', 'y'),
1896+        ('y', 'Y'),
1897+        ('hh', 'h'),
1898+        ('h', 'g'),
1899+        ('HH', 'H'),
1900+        ('H', 'G'),
1901+        ('mm', 'i'),
1902+        ('ss', 's'),
1903+        ('a', 'A'),
1904+        ('LLLL', 'F'),
1905+    )
1906+    if len(nodes):
1907+        original = nodes[0].text
1908+        result = ''
1909+        for cnt, segment in enumerate(original.split("'")):
1910+            if cnt % 2:
1911+                for char in SPECIAL_CHARS:
1912+                    segment = segment.replace(char, '\\%s' % char)
1913+                result += segment
1914+            else:
1915+                while segment:
1916+                    found = False
1917+                    for src, dst in FORMAT_STR_MAP:
1918+                        if segment[0:len(src)] == src:
1919+                            result += dst
1920+                            segment = segment[len(src):]
1921+                            found = True
1922+                            break
1923+                    if not found:
1924+                        result += segment[0]
1925+                        segment = segment[1:]
1926+
1927+        return "'%s'" % result
1928+    else:
1929+        return None
1930+
1931+def datetime(nodes, name, locale, previous):
1932+    result = None
1933+    if len(nodes) and 'DATE_FORMAT' in previous and 'TIME_FORMAT' in previous:
1934+        result = nodes[0].text
1935+        result = result.replace('{0}', previous['TIME_FORMAT'][1:-1])
1936+        if name == 'SHORT_DATETIME_FORMAT' and 'SHORT_DATE_FORMAT' in previous:
1937+            result = result.replace('{1}', previous['SHORT_DATE_FORMAT'][1:-1])
1938+        else:
1939+            result = result.replace('{1}', previous['DATE_FORMAT'][1:-1])
1940+    if result:
1941+        return "'%s'" % result
1942+    else:
1943+        return None
1944+
1945+FORMATS_MAP = [
1946+    {
1947+        'name': 'DATE_FORMAT',
1948+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1949+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='long']/dateFormat/pattern",
1950+        'conversion': convert_time,
1951+    },
1952+    {
1953+        'name': 'TIME_FORMAT',
1954+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1955+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/timeFormats/timeFormatLength[@type='medium']/timeFormat/pattern",
1956+        'conversion': convert_time,
1957+    },
1958+    {
1959+        'name': 'DATETIME_FORMAT',
1960+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1961+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='long']/dateTimeFormat/pattern",
1962+        'conversion': datetime,
1963+    },
1964+    {
1965+        'name': 'YEAR_MONTH_FORMAT',
1966+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1967+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='yMMMM']",
1968+        'conversion': convert_time,
1969+    },
1970+    {
1971+        'name': 'MONTH_DAY_FORMAT',
1972+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1973+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='MMMMd']",
1974+        'conversion': convert_time,
1975+    },
1976+    {
1977+        'name': 'SHORT_DATE_FORMAT',
1978+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1979+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='medium']/dateFormat/pattern",
1980+        'conversion': convert_time,
1981+    },
1982+    {
1983+        'name': 'SHORT_DATETIME_FORMAT',
1984+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1985+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='short']/dateTimeFormat/pattern",
1986+        'conversion': datetime,
1987+    },
1988+    {'name': 'FIRST_DAY_OF_WEEK'},
1989+    {'name': 'DATE_INPUT_FORMATS'},
1990+    {'name': 'TIME_INPUT_FORMATS'},
1991+    {'name': 'DATETIME_INPUT_FORMATS'},
1992+    {
1993+        'name': 'DECIMAL_SEPARATOR',
1994+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
1995+        'pattern': "/ldml/numbers/symbols/decimal",
1996+        'conversion': quote,
1997+    },
1998+    {
1999+        'name': 'THOUSAND_SEPARATOR',
2000+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
2001+        'pattern': "/ldml/numbers/symbols/group",
2002+        'conversion': quote,
2003+    },
2004+    {'name': 'NUMBER_GROUPING'},
2005+]
2006+"""
2007+"""
2008+
2009+def get_locales(django_locale_dir, locale=None):
2010+    if locale:
2011+        yield locale
2012+    else:
2013+        locale_re = re.compile('[a-z]{2}(_[A-Z]{2})?')
2014+        for locale in os.listdir(django_locale_dir):
2015+            if locale_re.match(locale):
2016+                yield locale
2017+
2018+def import_cldr(cldr_dir, locale=None, overwrite=False):
2019+    """
2020+    For every locale defined in Django, get from the CLDR locale file all
2021+    settings defined in output_structure, and write the result to the
2022+    locale directories on Django.
2023+    """
2024+    if not os.path.isdir(cldr_dir):
2025+        raise Exception, "Specified CLDR directory '%s' does not exist" % cldr_dir
2026+
2027+    import django
2028+    django_locale_dir = os.path.join(os.path.dirname(django.__file__), 'conf', 'locale')
2029+
2030+    for locale in get_locales(django_locale_dir, locale):
2031+        output_filename = os.path.join(django_locale_dir, locale, FORMATS_FILE_NAME)
2032+        if os.path.isfile(output_filename) and not overwrite:
2033+            print "'%s' locale already exists. Skipping" % locale
2034+        else:
2035+            result = {}
2036+            output_file = open(output_filename, 'w')
2037+            output_file.write(FORMATS_FILE_HEADER)
2038+            for format in FORMATS_MAP:
2039+                if 'file' in format:
2040+                    cldr_file = os.path.join(cldr_dir, format['file'] % dict(locale=locale))
2041+                    tree = etree.parse(cldr_file) # TODO: error control
2042+                    try:
2043+                        original_value = tree.xpath(format['pattern'])
2044+                    except IndexError:
2045+                        output_file.write('# %s = \n' % (format['name']))
2046+                    else:
2047+                        value = format['conversion'](original_value, format['name'], locale, result)
2048+                        if value:
2049+                            output_file.write('%s = %s\n' % (format['name'], value.encode('utf8')))
2050+                            result[format['name']] = value
2051+                        else:
2052+                            output_file.write('# %s = \n' % (format['name']))
2053+                else:
2054+                    output_file.write('# %s = \n' % (format['name']))
2055+            output_file.close()
2056+
2057+            init_filename = os.path.join(django_locale_dir, locale, '__init__.py')
2058+            open(init_filename, 'a').close()
2059+
2060+class Command(LabelCommand):
2061+    option_list = LabelCommand.option_list + (
2062+        make_option('--locale', '-l', dest='locale',
2063+            help='The locale to process. Default is to process all.'),
2064+    ) + (
2065+        make_option('--overwite', '-o', action='store_true', dest='overwrite',
2066+            help='Wheter to overwrite format definitions of locales that already have one.'),
2067+    )
2068+    help = 'Creates format definition files for locales, importing data from the CLDR.'
2069+    args = '[cldrpath]'
2070+    label = 'CLDR path'
2071+    requires_model_validation = False
2072+    can_import_settings = False
2073+
2074+    def handle_label(self, cldrpath, **options):
2075+        locale = options.get('locale')
2076+        overwrite = options.get('overwrite')
2077+        import_cldr(cldrpath, locale, overwrite)
2078+
2079diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
2080index e36b8a1..04ad24d 100644
2081--- a/django/forms/extras/widgets.py
2082+++ b/django/forms/extras/widgets.py
2083@@ -8,6 +8,8 @@ import re
2084 from django.forms.widgets import Widget, Select
2085 from django.utils.dates import MONTHS
2086 from django.utils.safestring import mark_safe
2087+from django.utils.formats import getformat
2088+from django.conf import settings
2089 
2090 __all__ = ('SelectDateWidget',)
2091 
2092@@ -45,38 +47,27 @@ class SelectDateWidget(Widget):
2093                 if match:
2094                     year_val, month_val, day_val = [int(v) for v in match.groups()]
2095 
2096-        output = []
2097-
2098-        if 'id' in self.attrs:
2099-            id_ = self.attrs['id']
2100-        else:
2101-            id_ = 'id_%s' % name
2102-
2103-        month_choices = MONTHS.items()
2104-        if not (self.required and value):
2105-            month_choices.append(self.none_value)
2106-        month_choices.sort()
2107-        local_attrs = self.build_attrs(id=self.month_field % id_)
2108-        s = Select(choices=month_choices)
2109-        select_html = s.render(self.month_field % name, month_val, local_attrs)
2110-        output.append(select_html)
2111-
2112-        day_choices = [(i, i) for i in range(1, 32)]
2113-        if not (self.required and value):
2114-            day_choices.insert(0, self.none_value)
2115-        local_attrs['id'] = self.day_field % id_
2116-        s = Select(choices=day_choices)
2117-        select_html = s.render(self.day_field % name, day_val, local_attrs)
2118-        output.append(select_html)
2119-
2120-        year_choices = [(i, i) for i in self.years]
2121-        if not (self.required and value):
2122-            year_choices.insert(0, self.none_value)
2123-        local_attrs['id'] = self.year_field % id_
2124-        s = Select(choices=year_choices)
2125-        select_html = s.render(self.year_field % name, year_val, local_attrs)
2126-        output.append(select_html)
2127+        choices = [(i, i) for i in self.years]
2128+        year_html = self.create_select(name, self.year_field, value, year_val, choices)
2129+        choices = MONTHS.items()
2130+        month_html = self.create_select(name, self.month_field, value, month_val, choices)
2131+        choices = [(i, i) for i in range(1, 32)]
2132+        day_html = self.create_select(name, self.day_field, value, day_val,  choices)
2133 
2134+        format = getformat('DATE_FORMAT')
2135+        escaped = False
2136+        output = []
2137+        for char in format:
2138+            if escaped:
2139+                escaped = False
2140+            elif char == '\\':
2141+                escaped = True
2142+            elif char in 'Yy':
2143+                output.append(year_html)
2144+            elif char in 'bFMmNn':
2145+                output.append(month_html)
2146+            elif char in 'dj':
2147+                output.append(day_html)
2148         return mark_safe(u'\n'.join(output))
2149 
2150     def id_for_label(self, id_):
2151@@ -90,5 +81,27 @@ class SelectDateWidget(Widget):
2152         if y == m == d == "0":
2153             return None
2154         if y and m and d:
2155-            return '%s-%s-%s' % (y, m, d)
2156+            if settings.USE_FORMAT_I18N:
2157+                input_format = getformat('DATE_INPUT_FORMATS')[0]
2158+                try:
2159+                    date_value = datetime.date(int(y), int(m), int(d))
2160+                except ValueError:
2161+                    pass
2162+                else:
2163+                    return date_value.strftime(input_format)
2164+            else:
2165+                return '%s-%s-%s' % (y, m, d)
2166         return data.get(name, None)
2167+
2168+    def create_select(self, name, field, value, val, choices):
2169+        if 'id' in self.attrs:
2170+            id_ = self.attrs['id']
2171+        else:
2172+            id_ = 'id_%s' % name
2173+        if not (self.required and value):
2174+            choices.insert(0, self.none_value)
2175+        local_attrs = self.build_attrs(id=field % id_)
2176+        s = Select(choices=choices)
2177+        select_html = s.render(field % name, val, local_attrs)
2178+        return select_html
2179+
2180diff --git a/django/forms/fields.py b/django/forms/fields.py
2181index 0aef355..6f8c222 100644
2182--- a/django/forms/fields.py
2183+++ b/django/forms/fields.py
2184@@ -26,15 +26,14 @@ except NameError:
2185 import django.core.exceptions
2186 from django.utils.translation import ugettext_lazy as _
2187 from django.utils.encoding import smart_unicode, smart_str
2188+from django.utils.formats import getformat
2189 
2190 from util import ErrorList, ValidationError
2191 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
2192 
2193 __all__ = (
2194     'Field', 'CharField', 'IntegerField',
2195-    'DEFAULT_DATE_INPUT_FORMATS', 'DateField',
2196-    'DEFAULT_TIME_INPUT_FORMATS', 'TimeField',
2197-    'DEFAULT_DATETIME_INPUT_FORMATS', 'DateTimeField', 'TimeField',
2198+    'DateField', 'TimeField', 'DateTimeField', 'TimeField',
2199     'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
2200     'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
2201     'ComboField', 'MultiValueField', 'FloatField', 'DecimalField',
2202@@ -209,7 +208,9 @@ class FloatField(Field):
2203         if not self.required and value in EMPTY_VALUES:
2204             return None
2205         try:
2206-            value = float(value)
2207+            # We always accept dot as decimal separator
2208+            if isinstance(value, str) or isinstance(value, unicode):
2209+                value = float(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
2210         except (ValueError, TypeError):
2211             raise ValidationError(self.error_messages['invalid'])
2212         if self.max_value is not None and value > self.max_value:
2213@@ -245,7 +246,9 @@ class DecimalField(Field):
2214             return None
2215         value = smart_str(value).strip()
2216         try:
2217-            value = Decimal(value)
2218+            # We always accept dot as decimal separator
2219+            if isinstance(value, str) or isinstance(value, unicode):
2220+                value = Decimal(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
2221         except DecimalException:
2222             raise ValidationError(self.error_messages['invalid'])
2223 
2224@@ -273,14 +276,6 @@ class DecimalField(Field):
2225             raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places))
2226         return value
2227 
2228-DEFAULT_DATE_INPUT_FORMATS = (
2229-    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
2230-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
2231-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
2232-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
2233-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
2234-)
2235-
2236 class DateField(Field):
2237     widget = DateInput
2238     default_error_messages = {
2239@@ -289,7 +284,7 @@ class DateField(Field):
2240 
2241     def __init__(self, input_formats=None, *args, **kwargs):
2242         super(DateField, self).__init__(*args, **kwargs)
2243-        self.input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
2244+        self.input_formats = input_formats
2245 
2246     def clean(self, value):
2247         """
2248@@ -303,18 +298,13 @@ class DateField(Field):
2249             return value.date()
2250         if isinstance(value, datetime.date):
2251             return value
2252-        for format in self.input_formats:
2253+        for format in self.input_formats or getformat('DATE_INPUT_FORMATS'):
2254             try:
2255                 return datetime.date(*time.strptime(value, format)[:3])
2256             except ValueError:
2257                 continue
2258         raise ValidationError(self.error_messages['invalid'])
2259 
2260-DEFAULT_TIME_INPUT_FORMATS = (
2261-    '%H:%M:%S',     # '14:30:59'
2262-    '%H:%M',        # '14:30'
2263-)
2264-
2265 class TimeField(Field):
2266     widget = TimeInput
2267     default_error_messages = {
2268@@ -323,7 +313,7 @@ class TimeField(Field):
2269 
2270     def __init__(self, input_formats=None, *args, **kwargs):
2271         super(TimeField, self).__init__(*args, **kwargs)
2272-        self.input_formats = input_formats or DEFAULT_TIME_INPUT_FORMATS
2273+        self.input_formats = input_formats
2274 
2275     def clean(self, value):
2276         """
2277@@ -335,25 +325,13 @@ class TimeField(Field):
2278             return None
2279         if isinstance(value, datetime.time):
2280             return value
2281-        for format in self.input_formats:
2282+        for format in self.input_formats or getformat('TIME_INPUT_FORMATS'):
2283             try:
2284                 return datetime.time(*time.strptime(value, format)[3:6])
2285             except ValueError:
2286                 continue
2287         raise ValidationError(self.error_messages['invalid'])
2288 
2289-DEFAULT_DATETIME_INPUT_FORMATS = (
2290-    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
2291-    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
2292-    '%Y-%m-%d',              # '2006-10-25'
2293-    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
2294-    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
2295-    '%m/%d/%Y',              # '10/25/2006'
2296-    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
2297-    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
2298-    '%m/%d/%y',              # '10/25/06'
2299-)
2300-
2301 class DateTimeField(Field):
2302     widget = DateTimeInput
2303     default_error_messages = {
2304@@ -362,7 +340,7 @@ class DateTimeField(Field):
2305 
2306     def __init__(self, input_formats=None, *args, **kwargs):
2307         super(DateTimeField, self).__init__(*args, **kwargs)
2308-        self.input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
2309+        self.input_formats = input_formats
2310 
2311     def clean(self, value):
2312         """
2313@@ -382,7 +360,7 @@ class DateTimeField(Field):
2314             if len(value) != 2:
2315                 raise ValidationError(self.error_messages['invalid'])
2316             value = '%s %s' % tuple(value)
2317-        for format in self.input_formats:
2318+        for format in self.input_formats or getformat('DATETIME_INPUT_FORMATS'):
2319             try:
2320                 return datetime.datetime(*time.strptime(value, format)[:6])
2321             except ValueError:
2322diff --git a/django/forms/widgets.py b/django/forms/widgets.py
2323index b1d2cb7..0161653 100644
2324--- a/django/forms/widgets.py
2325+++ b/django/forms/widgets.py
2326@@ -15,6 +15,7 @@ from django.utils.html import escape, conditional_escape
2327 from django.utils.translation import ugettext
2328 from django.utils.encoding import StrAndUnicode, force_unicode
2329 from django.utils.safestring import mark_safe
2330+from django.utils.formats import localize
2331 from django.utils import datetime_safe
2332 from datetime import time
2333 from util import flatatt
2334@@ -213,7 +214,7 @@ class Input(Widget):
2335         final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
2336         if value != '':
2337             # Only add the 'value' attribute if a value is non-empty.
2338-            final_attrs['value'] = force_unicode(value)
2339+            final_attrs['value'] = force_unicode(localize(value, is_input=True))
2340         return mark_safe(u'<input%s />' % flatatt(final_attrs))
2341 
2342 class TextInput(Input):
2343diff --git a/django/template/__init__.py b/django/template/__init__.py
2344index 8764bfa..4c386be 100644
2345--- a/django/template/__init__.py
2346+++ b/django/template/__init__.py
2347@@ -60,6 +60,7 @@ from django.utils.text import smart_split, unescape_string_literal
2348 from django.utils.encoding import smart_unicode, force_unicode, smart_str
2349 from django.utils.translation import ugettext as _
2350 from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping
2351+from django.utils.formats import localize
2352 from django.utils.html import escape
2353 
2354 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
2355@@ -815,6 +816,7 @@ def _render_value_in_context(value, context):
2356     means escaping, if required, and conversion to a unicode object. If value
2357     is a string, it is expected to have already been translated.
2358     """
2359+    value = localize(value)
2360     value = force_unicode(value)
2361     if (context.autoescape and not isinstance(value, SafeData)) or isinstance(value, EscapeData):
2362         return escape(value)
2363diff --git a/django/template/debug.py b/django/template/debug.py
2364index c58c854..382fb75 100644
2365--- a/django/template/debug.py
2366+++ b/django/template/debug.py
2367@@ -2,6 +2,7 @@ from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, Templ
2368 from django.utils.encoding import force_unicode
2369 from django.utils.html import escape
2370 from django.utils.safestring import SafeData, EscapeData
2371+from django.utils.formats import localize
2372 
2373 class DebugLexer(Lexer):
2374     def __init__(self, template_string, origin):
2375@@ -84,7 +85,9 @@ class DebugNodeList(NodeList):
2376 class DebugVariableNode(VariableNode):
2377     def render(self, context):
2378         try:
2379-            output = force_unicode(self.filter_expression.resolve(context))
2380+            output = self.filter_expression.resolve(context)
2381+            output = localize(output)
2382+            output = force_unicode(output)
2383         except TemplateSyntaxError, e:
2384             if not hasattr(e, 'source'):
2385                 e.source = self.source
2386diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
2387index a8c2567..26b6b5e 100644
2388--- a/django/template/defaultfilters.py
2389+++ b/django/template/defaultfilters.py
2390@@ -18,6 +18,7 @@ from django.conf import settings
2391 from django.utils.translation import ugettext, ungettext
2392 from django.utils.encoding import force_unicode, iri_to_uri
2393 from django.utils.safestring import mark_safe, SafeData
2394+from django.utils.formats import date_format, number_format
2395 
2396 register = Library()
2397 
2398@@ -166,14 +167,14 @@ def floatformat(text, arg=-1):
2399         return input_val
2400 
2401     if not m and p < 0:
2402-        return mark_safe(u'%d' % (int(d)))
2403+        return mark_safe(number_format(u'%d' % (int(d)), 0))
2404 
2405     if p == 0:
2406         exp = Decimal(1)
2407     else:
2408         exp = Decimal('1.0') / (Decimal(10) ** abs(p))
2409     try:
2410-        return mark_safe(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)))
2411+        return mark_safe(number_format(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)), abs(p)))
2412     except InvalidOperation:
2413         return input_val
2414 floatformat.is_safe = True
2415@@ -685,9 +686,12 @@ def date(value, arg=None):
2416     if arg is None:
2417         arg = settings.DATE_FORMAT
2418     try:
2419-        return format(value, arg)
2420+        return date_format(value, arg)
2421     except AttributeError:
2422-        return ''
2423+        try:
2424+            return format(value, arg)
2425+        except AttributeError:
2426+            return ''
2427 date.is_safe = False
2428 
2429 def time(value, arg=None):
2430@@ -698,9 +702,12 @@ def time(value, arg=None):
2431     if arg is None:
2432         arg = settings.TIME_FORMAT
2433     try:
2434-        return time_format(value, arg)
2435+        return date_format(value, arg)
2436     except AttributeError:
2437-        return ''
2438+        try:
2439+            return time_format(value, arg)
2440+        except AttributeError:
2441+            return ''
2442 time.is_safe = False
2443 
2444 def timesince(value, arg=None):
2445diff --git a/django/utils/formats.py b/django/utils/formats.py
2446new file mode 100644
2447index 0000000..0976395
2448--- /dev/null
2449+++ b/django/utils/formats.py
2450@@ -0,0 +1,97 @@
2451+import decimal
2452+import datetime
2453+
2454+from django.conf import settings
2455+from django.utils.translation import get_language
2456+from django.utils.importlib import import_module
2457+from django.utils import dateformat
2458+from django.utils import numberformat
2459+
2460+def project_formats_module():
2461+    """
2462+    Returns the formats module for the current locale, defined
2463+    on the project
2464+    """
2465+    if settings.FORMAT_MODULE_PATH:
2466+        try:
2467+            return import_module('.formats', '%s.%s' % (
2468+                settings.FORMAT_MODULE_PATH, get_language().split('-')[0]))
2469+        except ImportError:
2470+            pass
2471+    return None
2472+
2473+def django_formats_module():
2474+    """
2475+    Returns the formats module for the current locale, defined
2476+    on Django
2477+    """
2478+    try:
2479+        return import_module('.formats',
2480+            'django.conf.locale.%s' % get_language().split('-')[0])
2481+    except ImportError:
2482+        return None
2483+
2484+def getformat(format_type):
2485+    """
2486+    For a specific format type, returns the format for the
2487+    current language (locale) defaulting to the format on settings.
2488+    format_type is the name of the format, for example 'DATE_FORMAT'
2489+    """
2490+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2491+        for module in (project_formats_module(), django_formats_module()):
2492+            if module:
2493+                try:
2494+                    return getattr(module, format_type)
2495+                except AttributeError:
2496+                    pass
2497+    return getattr(settings, format_type)
2498+
2499+def date_format(value, format=None):
2500+    """
2501+    Formats a datetime.date or datetime.datetime object using a
2502+    localizable format
2503+    """
2504+    return dateformat.format(value, getformat(format or 'DATE_FORMAT'))
2505+
2506+def number_format(value, decimal_pos=None):
2507+    """
2508+    Formats a numeric value using localization settings
2509+    """
2510+    return numberformat.format(
2511+        value,
2512+        getformat('DECIMAL_SEPARATOR'),
2513+        decimal_pos,
2514+        getformat('NUMBER_GROUPING'),
2515+        getformat('THOUSAND_SEPARATOR'),
2516+    )
2517+
2518+def localize(value, is_input=False):
2519+    """
2520+    Checks value, and if it has a localizable type (date,
2521+    number...) it returns the value as a string using
2522+    current locale format
2523+    """
2524+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2525+        if isinstance(value, decimal.Decimal):
2526+            return number_format(value)
2527+        elif isinstance(value, float):
2528+            return number_format(value)
2529+        elif isinstance(value, int):
2530+            return number_format(value)
2531+        elif isinstance(value, datetime.datetime):
2532+            if not is_input:
2533+                return date_format(value, 'DATETIME_FORMAT')
2534+            else:
2535+                return value.strftime(getformat('DATETIME_INPUT_FORMATS')[0])
2536+        elif isinstance(value, datetime.date):
2537+            if not is_input:
2538+                return date_format(value)
2539+            else:
2540+                return value.strftime(getformat('DATE_INPUT_FORMATS')[0])
2541+        elif isinstance(value, datetime.time):
2542+            if not is_input:
2543+                return date_format(value, 'TIME_FORMAT')
2544+            else:
2545+                return value.strftime(getformat('TIME_INPUT_FORMATS')[0])
2546+    return value
2547+
2548diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
2549new file mode 100644
2550index 0000000..78ecb2f
2551--- /dev/null
2552+++ b/django/utils/numberformat.py
2553@@ -0,0 +1,42 @@
2554+from django.conf import settings
2555+
2556+def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
2557+    """
2558+    Gets a number (as a number or string), and returns it as a string,
2559+    using formats definied as arguments:
2560+
2561+    * decimal_sep: Decimal separator symbol (for example ".")
2562+    * decimal_pos: Number of decimal positions
2563+    * grouping: Number of digits in every group limited by thousand separator
2564+    * thousand_sep: Thousand separator symbol (for example ",")
2565+
2566+    """
2567+    # sign
2568+    if float(number) < 0:
2569+        sign = '-'
2570+    else:
2571+        sign = ''
2572+    # decimal part
2573+    str_number = unicode(number)
2574+    if str_number[0] == '-':
2575+        str_number = str_number[1:]
2576+    if '.' in str_number:
2577+        int_part, dec_part = str_number.split('.')
2578+        if decimal_pos:
2579+            dec_part = dec_part[:decimal_pos]
2580+    else:
2581+        int_part, dec_part = str_number, ''
2582+    if decimal_pos:
2583+        dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
2584+    if dec_part: dec_part = decimal_sep + dec_part
2585+    # grouping
2586+    if settings.USE_THOUSAND_SEPARATOR and grouping:
2587+        int_part_gd = ''
2588+        for cnt, digit in enumerate(int_part[::-1]):
2589+            if cnt and not cnt % grouping:
2590+                int_part_gd += thousand_sep
2591+            int_part_gd += digit
2592+        int_part = int_part_gd[::-1]
2593+
2594+    return sign + int_part + dec_part
2595+
2596diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py
2597index 98c6de6..7a57139 100644
2598--- a/django/utils/translation/trans_null.py
2599+++ b/django/utils/translation/trans_null.py
2600@@ -18,10 +18,10 @@ activate = lambda x: None
2601 deactivate = deactivate_all = lambda: None
2602 get_language = lambda: settings.LANGUAGE_CODE
2603 get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
2604-get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
2605-get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
2606 check_for_language = lambda x: True
2607 
2608+# date formats shouldn't be used using gettext anymore. This
2609+# is kept for backward compatibility
2610 TECHNICAL_ID_MAP = {
2611     "DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
2612     "DATE_FORMAT": settings.DATE_FORMAT,
2613@@ -51,3 +51,8 @@ def to_locale(language):
2614 
2615 def get_language_from_request(request):
2616     return settings.LANGUAGE_CODE
2617+
2618+# get_date_formats and get_partial_date_formats aren't used anymore from django
2619+# itself, and are kept for backward compatibility.
2620+get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
2621+get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
2622diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
2623index 48ed7cc..e9f0a36 100644
2624--- a/django/utils/translation/trans_real.py
2625+++ b/django/utils/translation/trans_real.py
2626@@ -266,15 +266,16 @@ def do_translate(message, translation_function):
2627     translation object to use. If no current translation is activated, the
2628     message will be run through the default translation object.
2629     """
2630+    eol_message = message.replace('\r\n', '\n').replace('\r', '\n')
2631     global _default, _active
2632     t = _active.get(currentThread(), None)
2633     if t is not None:
2634-        result = getattr(t, translation_function)(message)
2635+        result = getattr(t, translation_function)(eol_message)
2636     else:
2637         if _default is None:
2638             from django.conf import settings
2639             _default = translation(settings.LANGUAGE_CODE)
2640-        result = getattr(_default, translation_function)(message)
2641+        result = getattr(_default, translation_function)(eol_message)
2642     if isinstance(message, SafeData):
2643         return mark_safe(result)
2644     return result
2645@@ -389,39 +390,6 @@ def get_language_from_request(request):
2646 
2647     return settings.LANGUAGE_CODE
2648 
2649-def get_date_formats():
2650-    """
2651-    Checks whether translation files provide a translation for some technical
2652-    message ID to store date and time formats. If it doesn't contain one, the
2653-    formats provided in the settings will be used.
2654-    """
2655-    from django.conf import settings
2656-    date_format = ugettext('DATE_FORMAT')
2657-    datetime_format = ugettext('DATETIME_FORMAT')
2658-    time_format = ugettext('TIME_FORMAT')
2659-    if date_format == 'DATE_FORMAT':
2660-        date_format = settings.DATE_FORMAT
2661-    if datetime_format == 'DATETIME_FORMAT':
2662-        datetime_format = settings.DATETIME_FORMAT
2663-    if time_format == 'TIME_FORMAT':
2664-        time_format = settings.TIME_FORMAT
2665-    return date_format, datetime_format, time_format
2666-
2667-def get_partial_date_formats():
2668-    """
2669-    Checks whether translation files provide a translation for some technical
2670-    message ID to store partial date formats. If it doesn't contain one, the
2671-    formats provided in the settings will be used.
2672-    """
2673-    from django.conf import settings
2674-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2675-    month_day_format = ugettext('MONTH_DAY_FORMAT')
2676-    if year_month_format == 'YEAR_MONTH_FORMAT':
2677-        year_month_format = settings.YEAR_MONTH_FORMAT
2678-    if month_day_format == 'MONTH_DAY_FORMAT':
2679-        month_day_format = settings.MONTH_DAY_FORMAT
2680-    return year_month_format, month_day_format
2681-
2682 dot_re = re.compile(r'\S')
2683 def blankout(src, char):
2684     """
2685@@ -537,3 +505,42 @@ def parse_accept_lang_header(lang_string):
2686         result.append((lang, priority))
2687     result.sort(lambda x, y: -cmp(x[1], y[1]))
2688     return result
2689+
2690+# get_date_formats and get_partial_date_formats aren't used anymore from django
2691+# itself, and are kept for backward compatibility.
2692+# Note that it's also important to keep format names maked for translation, so
2693+# for compatibility we still want to have formats on translation catalogs. That
2694+# makes template code like {{ my_date|date:_('DATE_FORMAT') }} go on working
2695+def get_date_formats():
2696+    """
2697+    Checks whether translation files provide a translation for some technical
2698+    message ID to store date and time formats. If it doesn't contain one, the
2699+    formats provided in the settings will be used.
2700+    """
2701+    from django.conf import settings
2702+    date_format = ugettext('DATE_FORMAT')
2703+    datetime_format = ugettext('DATETIME_FORMAT')
2704+    time_format = ugettext('TIME_FORMAT')
2705+    if date_format == 'DATE_FORMAT':
2706+        date_format = settings.DATE_FORMAT
2707+    if datetime_format == 'DATETIME_FORMAT':
2708+        datetime_format = settings.DATETIME_FORMAT
2709+    if time_format == 'TIME_FORMAT':
2710+        time_format = settings.TIME_FORMAT
2711+    return date_format, datetime_format, time_format
2712+
2713+def get_partial_date_formats():
2714+    """
2715+    Checks whether translation files provide a translation for some technical
2716+    message ID to store partial date formats. If it doesn't contain one, the
2717+    formats provided in the settings will be used.
2718+    """
2719+    from django.conf import settings
2720+    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2721+    month_day_format = ugettext('MONTH_DAY_FORMAT')
2722+    if year_month_format == 'YEAR_MONTH_FORMAT':
2723+        year_month_format = settings.YEAR_MONTH_FORMAT
2724+    if month_day_format == 'MONTH_DAY_FORMAT':
2725+        month_day_format = settings.MONTH_DAY_FORMAT
2726+    return year_month_format, month_day_format
2727+
2728diff --git a/django/views/i18n.py b/django/views/i18n.py
2729index 0280698..4bfbf5e 100644
2730--- a/django/views/i18n.py
2731+++ b/django/views/i18n.py
2732@@ -3,6 +3,7 @@ from django.conf import settings
2733 from django.utils import importlib
2734 from django.utils.translation import check_for_language, activate, to_locale, get_language
2735 from django.utils.text import javascript_quote
2736+from django.utils.formats import project_formats_module, django_formats_module
2737 import os
2738 import gettext as gettext_module
2739 
2740@@ -32,6 +33,25 @@ def set_language(request):
2741                 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
2742     return response
2743 
2744+def get_formats():
2745+    """
2746+    Returns an iterator over all formats in formats file
2747+    """
2748+    FORMAT_SETTINGS = ('DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT',
2749+        'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT',
2750+        'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR',
2751+        'THOUSAND_SEPARATOR', 'NUMBER_GROUPING')
2752+
2753+    result = {}
2754+    for module in (settings, django_formats_module(), project_formats_module()):
2755+        if module:
2756+            for attr in FORMAT_SETTINGS:
2757+                try:
2758+                    result[attr] = getattr(module, attr)
2759+                except AttributeError:
2760+                    pass
2761+    return result
2762+
2763 NullSource = """
2764 /* gettext identity library */
2765 
2766@@ -185,10 +205,13 @@ def javascript_catalog(request, domain='djangojs', packages=None):
2767         else:
2768             raise TypeError, k
2769     csrc.sort()
2770-    for k,v in pdict.items():
2771+    for k, v in pdict.items():
2772         src.append("catalog['%s'] = [%s];\n" % (javascript_quote(k), ','.join(["''"]*(v+1))))
2773+    for k, v in get_formats().items():
2774+        src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v))))
2775     src.extend(csrc)
2776     src.append(LibFoot)
2777     src.append(InterPolate)
2778     src = ''.join(src)
2779     return http.HttpResponse(src, 'text/javascript')
2780+
2781diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
2782index 8ff1509..1b57adf 100644
2783--- a/docs/ref/settings.txt
2784+++ b/docs/ref/settings.txt
2785@@ -288,12 +288,32 @@ DATE_FORMAT
2786 
2787 Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
2788 
2789-The default formatting to use for date fields on Django admin change-list
2790-pages -- and, possibly, by other parts of the system. See
2791-:ttag:`allowed date format strings <now>`.
2792+The default formatting to use for date fields in any part of the system.
2793+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2794+be applied. See :ttag:`allowed date format strings <now>`.
2795+
2796+See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.
2797+
2798+.. setting:: DATE_INPUT_FORMATS
2799 
2800-See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``
2801-and ``MONTH_DAY_FORMAT``.
2802+DATE_INPUT_FORMATS
2803+------------------
2804+
2805+Default::
2806+
2807+    ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
2808+    '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
2809+    '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
2810+
2811+A tuple of formats that will be accepted when inputting data on a date
2812+field. Formats will be tried in order, using the first valid.
2813+Note that these format strings are specified in Python's datetime_ module
2814+syntax, that is different from the one used by Django for formatting dates
2815+to be displayed.
2816+
2817+See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2818+
2819+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2820 
2821 .. setting:: DATETIME_FORMAT
2822 
2823@@ -302,12 +322,32 @@ DATETIME_FORMAT
2824 
2825 Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
2826 
2827-The default formatting to use for datetime fields on Django admin change-list
2828-pages -- and, possibly, by other parts of the system. See
2829-:ttag:`allowed date format strings <now>`.
2830+The default formatting to use for datetime fields in any part of the system.
2831+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2832+be applied. See :ttag:`allowed date format strings <now>`.
2833+
2834+See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2835 
2836-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
2837-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
2838+.. setting:: DATETIME_INPUT_FORMATS
2839+
2840+DATETIME_INPUT_FORMATS
2841+----------------------
2842+
2843+Default::
2844+
2845+    ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
2846+    '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
2847+    '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
2848+
2849+A tuple of formats that will be accepted when inputting data on a datetime
2850+field. Formats will be tried in order, using the first valid.
2851+Note that these format strings are specified in Python's datetime_ module
2852+syntax, that is different from the one used by Django for formatting dates
2853+to be displayed.
2854+
2855+See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2856+
2857+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2858 
2859 .. setting:: DEBUG
2860 
2861@@ -347,6 +387,14 @@ will be suppressed, and exceptions will propagate upwards.  This can
2862 be useful for some test setups, and should never be used on a live
2863 site.
2864 
2865+.. setting:: DECIMAL_SEPARATOR
2866+
2867+DECIMAL_SEPARATOR
2868+-----------------
2869+
2870+Default: ``'.'`` (Dot)
2871+
2872+Default decimal separator used when formatting decimal numbers.
2873 
2874 .. setting:: DEFAULT_CHARSET
2875 
2876@@ -596,6 +644,21 @@ system's standard umask.
2877 
2878 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
2879 
2880+.. setting:: FIRST_DAY_OF_WEEK
2881+
2882+FIRST_DAY_OF_WEEK
2883+-----------------
2884+
2885+Default: ``0`` (Sunday)
2886+
2887+Number representing the first day of the week. This is specially useful
2888+when displaying a calendar. This value is only used when not using
2889+format internationalization, or when a format cannot be found for the
2890+current locale.
2891+
2892+The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
2893+Monday and so on.
2894+
2895 .. setting:: FIXTURE_DIRS
2896 
2897 FIXTURE_DIRS
2898@@ -617,6 +680,34 @@ environment variable in any HTTP request. This setting can be used to override
2899 the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
2900 of the preferred value or not supplied at all.
2901 
2902+.. setting:: FORMAT_MODULE_PATH
2903+
2904+FORMAT_MODULE_PATH
2905+------------------
2906+
2907+Default: ``None``
2908+
2909+A full Python path to a Python package that contains format definitions for
2910+project locales. If not ``None``, Django will check for a ``formats.py``
2911+file, under the directory named as the current locale, and will use the
2912+formats defined on this file.
2913+
2914+For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and
2915+current language is ``en`` (English), Django will expect a directory tree
2916+like::
2917+
2918+    mysite/
2919+        formats/
2920+            __init__.py
2921+            en/
2922+                __init__.py
2923+                formats.py
2924+
2925+Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,
2926+``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,
2927+``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,
2928+``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
2929+
2930 .. setting:: IGNORABLE_404_ENDS
2931 
2932 IGNORABLE_404_ENDS
2933@@ -886,6 +977,21 @@ locales have different formats. For example, U.S. English would say
2934 See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
2935 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
2936 
2937+.. setting:: NUMBER_GROUPING
2938+
2939+NUMBER_GROUPING
2940+----------------
2941+
2942+Default: ``0``
2943+
2944+Number of digits grouped together on the integer part of a number. Common use
2945+is to display a thousand separator. If this setting is ``0``, then, no grouping
2946+will be applied to the number. If this setting is greater than ``0`` then the
2947+setting ``THOUSAND_SEPARATOR`` will be used as the separator between those
2948+groups.
2949+
2950+See also ``THOUSAND_SEPARATOR``
2951+
2952 .. setting:: PREPEND_WWW
2953 
2954 PREPEND_WWW
2955@@ -1077,6 +1183,32 @@ Default: ``False``
2956 Whether to save the session data on every request. See
2957 :ref:`topics-http-sessions`.
2958 
2959+.. setting:: SHORT_DATE_FORMAT
2960+
2961+SHORT_DATE_FORMAT
2962+-----------------
2963+
2964+Default: ``m/d/Y`` (e.g. ``12/31/2003``)
2965+
2966+An available formatting that can be used for date fields on templates.
2967+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2968+be applied. See :ttag:`allowed date format strings <now>`.
2969+
2970+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2971+
2972+.. setting:: SHORT_DATETIME_FORMAT
2973+
2974+SHORT_DATETIME_FORMAT
2975+---------------------
2976+
2977+Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
2978+
2979+An available formatting that can be used for datetime fields on templates.
2980+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2981+be applied. See :ttag:`allowed date format strings <now>`.
2982+
2983+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2984+
2985 .. setting:: SITE_ID
2986 
2987 SITE_ID
2988@@ -1231,6 +1363,18 @@ The name of the method to use for starting the test suite. See
2989 
2990 .. _Testing Django Applications: ../testing/
2991 
2992+.. setting:: THOUSAND_SEPARATOR
2993+
2994+THOUSAND_SEPARATOR
2995+------------------
2996+
2997+Default ``,`` (Comma)
2998+
2999+Default thousand separator used when formatting numbers. This setting is
3000+used only when ``NUMBER_GROUPPING`` is set.
3001+
3002+See also ``NUMBER_GROUPPING``, ``DECIMAL_SEPARATOR``
3003+
3004 .. setting:: TIME_FORMAT
3005 
3006 TIME_FORMAT
3007@@ -1238,12 +1382,28 @@ TIME_FORMAT
3008 
3009 Default: ``'P'`` (e.g. ``4 p.m.``)
3010 
3011-The default formatting to use for time fields on Django admin change-list
3012-pages -- and, possibly, by other parts of the system. See
3013-:ttag:`allowed date format strings <now>`.
3014+The default formatting to use for time fields in any part of the system.
3015+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
3016+be applied. See :ttag:`allowed date format strings <now>`.
3017 
3018-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
3019-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
3020+See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.
3021+
3022+.. setting:: TIME_INPUT_FORMATS
3023+
3024+TIME_INPUT_FORMATS
3025+------------------
3026+
3027+Default: ``('%H:%M:%S', '%H:%M')``
3028+
3029+A tuple of formats that will be accepted when inputting data on a time
3030+field. Formats will be tried in order, using the first valid.
3031+Note that these format strings are specified in Python's datetime_ module
3032+syntax, that is different from the one used by Django for formatting dates
3033+to be displayed.
3034+
3035+See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.
3036+
3037+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
3038 
3039 .. setting:: TIME_ZONE
3040 
3041@@ -1298,6 +1458,20 @@ A boolean that specifies whether to output the "Etag" header. This saves
3042 bandwidth but slows down performance. This is only used if ``CommonMiddleware``
3043 is installed (see :ref:`topics-http-middleware`).
3044 
3045+.. setting:: USE_FORMAT_I18N
3046+
3047+USE_FORMAT_I18N
3048+---------------
3049+
3050+Default ``False``
3051+
3052+A boolean that specifies if data will be localized by default or not. If this is
3053+set to ``True``, Django will display numbers and dates using the format of the
3054+current locale. It is required to set ``USE_I18N`` to ``True`` to allow data
3055+format localization.
3056+
3057+See also ``USE_I18N``
3058+
3059 .. setting:: USE_I18N
3060 
3061 USE_I18N
3062@@ -1310,6 +1484,22 @@ enabled. This provides an easy way to turn it off, for performance. If this is
3063 set to ``False``, Django will make some optimizations so as not to load the
3064 internationalization machinery.
3065 
3066+See also ``USE_FORMAT_I18N``
3067+
3068+.. setting:: USE_THOUSAND_SEPARATOR
3069+
3070+USE_THOUSAND_SEPARATOR
3071+----------------------
3072+
3073+Default ``False``
3074+
3075+A boolean that specifies wheter to display numbers using a thousand separator.
3076+If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``
3077+and ``NUMBER_GROUPING`` from current locale, to format the number.
3078+``USE_FORMAT_I18N`` must be set to ``True``, in order to format numbers.
3079+
3080+See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
3081+
3082 .. setting:: YEAR_MONTH_FORMAT
3083 
3084 YEAR_MONTH_FORMAT
3085diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
3086index bf2d9e8..29ccfef 100644
3087--- a/docs/ref/templates/builtins.txt
3088+++ b/docs/ref/templates/builtins.txt
3089@@ -1047,7 +1047,11 @@ If ``value`` is ``"String with spaces"``, the output will be ``"Stringwithspaces
3090 date
3091 ~~~~
3092 
3093-Formats a date according to the given format (same as the `now`_ tag).
3094+Formats a date according to the given format.
3095+
3096+Given format can be one of the predefined ones ``DATE_FORMAT``, ``DATETIME_FORMAT``,
3097+``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a custom format, same as the
3098+`now`_ tag. Note that prefedined formats vary depending on the current locale.
3099 
3100 For example::
3101 
3102@@ -1062,7 +1066,7 @@ When used without a format string::
3103     {{ value|date }}
3104 
3105 ...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
3106-used.
3107+used, without applying any localization.
3108 
3109 .. templatefilter:: default
3110 
3111@@ -1610,7 +1614,11 @@ output will be ``"Joel is a slug"``.
3112 time
3113 ~~~~
3114 
3115-Formats a time according to the given format (same as the `now`_ tag).
3116+Formats a time according to the given format.
3117+
3118+Given format can be the predefined one ``TIME_FORMAT``, or a custom format,
3119+same as the `now`_ tag. Note that the predefined format is locale depending.
3120+
3121 The time filter will only accept parameters in the format string that relate
3122 to the time of day, not the date (for obvious reasons). If you need to
3123 format a date, use the `date`_ filter.
3124@@ -1627,7 +1635,7 @@ When used without a format string::
3125     {{ value|time }}
3126 
3127 ...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
3128-used.
3129+used, without aplying any localization.
3130 
3131 .. templatefilter:: timesince
3132 
3133diff --git a/docs/topics/i18n.txt b/docs/topics/i18n.txt
3134index c5f4ab6..0fd2663 100644
3135--- a/docs/topics/i18n.txt
3136+++ b/docs/topics/i18n.txt
3137@@ -4,20 +4,21 @@
3138 Internationalization
3139 ====================
3140 
3141-Django has full support for internationalization of text in code and templates.
3142-Here's how it works.
3143+Django has full support for internationalization, including translation
3144+capabilities of text in code and templates, and format localization for
3145+dates and numbers. Here's how it works.
3146 
3147 Overview
3148 ========
3149 
3150 The goal of internationalization is to allow a single Web application to offer
3151-its content and functionality in multiple languages.
3152+its content and functionality in multiple languages and locales.
3153 
3154-You, the Django developer, can accomplish this goal by adding a minimal amount
3155-of hooks to your Python code and templates. These hooks are called
3156-**translation strings**. They tell Django: "This text should be translated into
3157-the end user's language, if a translation for this text is available in that
3158-language."
3159+For text translation, you, the Django developer, can accomplish this goal by
3160+adding a minimal amount of hooks to your Python code and templates. These hooks
3161+are called **translation strings**. They tell Django: "This text should be
3162+translated into the end user's language, if a translation for this text is
3163+available in that language."
3164 
3165 Django takes care of using these hooks to translate Web apps, on the fly,
3166 according to users' language preferences.
3167@@ -29,6 +30,12 @@ Essentially, Django does two things:
3168     * It uses these hooks to translate Web apps for particular users according
3169       to their language preferences.
3170 
3171+For format localization, it's just necessary to set
3172+:setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings file. If
3173+:settings:`USE_FORMAT_I18N` is set to ``True``, then Django will display
3174+numbers and dates in the format of the current locale. That includes field
3175+representation on templates, and allowed input formats on the admin.
3176+
3177 If you don't need internationalization in your app
3178 ==================================================
3179 
3180@@ -1074,3 +1081,53 @@ have been found to not support this command. Do not attempt to use Django
3181 translation utilities with a ``gettext`` package if the command ``xgettext
3182 --version`` entered at a Windows command prompt causes a popup window saying
3183 "xgettext.exe has generated errors and will be closed by Windows".
3184+
3185+Format localization
3186+===================
3187+
3188+Django's formatting system is disabled by default. To enable it, it's necessay
3189+to set :setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings
3190+file.  Note that :setting:`USE_FORMAT_I18N` requires `USE_I18N` to be ``True``.
3191+
3192+When using Django's formatting system, dates and numbers on templates will be
3193+displayed using the format specified for the current locale. That means, two
3194+users accessing the same content, but in different language, will see date and
3195+number fields formatted in different ways, depending on the format for their
3196+current locale.
3197+
3198+Django will also use localized formats when parsing data in forms. That means
3199+Django uses different formats for different locales when guessing the format
3200+used by the user when inputting data on forms. Note that Django uses different
3201+formats for displaying data, and for parsing it.
3202+
3203+Creating custom format files
3204+----------------------------
3205+
3206+Django provides format definitions for many locales, but sometimes you could
3207+want to create your own ones, because a format files doesn't exist for your
3208+locale, or because you want to overwrite some of the values.
3209+
3210+To use custom formats, first thing to do, is to specify the path where you'll
3211+place format files. To do that, just set :setting:`FORMAT_MODULE_PATH` setting
3212+to the the path (in the format ``'foo.bar.baz``) where format files will
3213+exists.
3214+
3215+Files are not placed directly in this directory, but in a directory named as
3216+the locale. File must be named ``formats.py``.
3217+
3218+For customazing English formats, a structure like this would be needed::
3219+
3220+    mysite/
3221+        formats/
3222+            __init__.py
3223+            en/
3224+                __init__.py
3225+                formats.py
3226+
3227+where :file:`formats.py` contains custom format definitions. For example::
3228+
3229+    THOUSAND_SEPARATOR = ' '
3230+
3231+to use a space as thousand separator, instead of the default for English,
3232+comma.
3233+
3234diff --git a/tests/regressiontests/i18n/misc.py b/tests/regressiontests/i18n/misc.py
3235deleted file mode 100644
3236index f8f35ad..0000000
3237--- a/tests/regressiontests/i18n/misc.py
3238+++ /dev/null
3239@@ -1,114 +0,0 @@
3240-import sys
3241-
3242-tests = """
3243->>> from django.utils.translation.trans_real import parse_accept_lang_header
3244->>> p = parse_accept_lang_header
3245-
3246-#
3247-# Testing HTTP header parsing. First, we test that we can parse the values
3248-# according to the spec (and that we extract all the pieces in the right order).
3249-#
3250-
3251-Good headers.
3252->>> p('de')
3253-[('de', 1.0)]
3254->>> p('en-AU')
3255-[('en-AU', 1.0)]
3256->>> p('*;q=1.00')
3257-[('*', 1.0)]
3258->>> p('en-AU;q=0.123')
3259-[('en-AU', 0.123)]
3260->>> p('en-au;q=0.1')
3261-[('en-au', 0.10000000000000001)]
3262->>> p('en-au;q=1.0')
3263-[('en-au', 1.0)]
3264->>> p('da, en-gb;q=0.25, en;q=0.5')
3265-[('da', 1.0), ('en', 0.5), ('en-gb', 0.25)]
3266->>> p('en-au-xx')
3267-[('en-au-xx', 1.0)]
3268->>> p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')
3269-[('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)]
3270->>> p('*')
3271-[('*', 1.0)]
3272->>> p('de;q=0.')
3273-[('de', 1.0)]
3274->>> p('')
3275-[]
3276-
3277-Bad headers; should always return [].
3278->>> p('en-gb;q=1.0000')
3279-[]
3280->>> p('en;q=0.1234')
3281-[]
3282->>> p('en;q=.2')
3283-[]
3284->>> p('abcdefghi-au')
3285-[]
3286->>> p('**')
3287-[]
3288->>> p('en,,gb')
3289-[]
3290->>> p('en-au;q=0.1.0')
3291-[]
3292->>> p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en')
3293-[]
3294->>> p('da, en-gb;q=0.8, en;q=0.7,#')
3295-[]
3296->>> p('de;q=2.0')
3297-[]
3298->>> p('de;q=0.a')
3299-[]
3300->>> p('')
3301-[]
3302-
3303-#
3304-# Now test that we parse a literal HTTP header correctly.
3305-#
3306-
3307->>> from django.utils.translation.trans_real import get_language_from_request
3308->>> g = get_language_from_request
3309->>> from django.http import HttpRequest
3310->>> r = HttpRequest
3311->>> r.COOKIES = {}
3312-
3313-These tests assumes the es, es_AR, pt and pt_BR translations exit in the Django
3314-source tree.
3315->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3316->>> g(r)
3317-'pt-br'
3318->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3319->>> g(r)
3320-'pt'
3321->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3322->>> g(r)
3323-'es'
3324->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3325->>> g(r)
3326-'es-ar'
3327-"""
3328-
3329-# Python 2.3 and 2.4 return slightly different results for completely bogus
3330-# locales, so we omit this test for that anything below 2.4. It's relatively
3331-# harmless in any cases (GIGO). This also means this won't be executed on
3332-# Jython currently, but life's like that sometimes. (On those platforms,
3333-# passing in a truly bogus locale will get you the default locale back.)
3334-if sys.version_info >= (2, 5):
3335-    tests += """
3336-This test assumes there won't be a Django translation to a US variation
3337-of the Spanish language, a safe assumption. When the user sets it
3338-as the preferred language, the main 'es' translation should be selected
3339-instead.
3340->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3341->>> g(r)
3342-'es'
3343-"""
3344-
3345-tests += """
3346-This tests the following scenario: there isn't a main language (zh)
3347-translation of Django but there is a translation to variation (zh_CN)
3348-the user sets zh-cn as the preferred language, it should be selected by
3349-Django without falling back nor ignoring it.
3350->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3351->>> g(r)
3352-'zh-cn'
3353-"""
3354diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
3355index 94e792c..2c1acac 100644
3356--- a/tests/regressiontests/i18n/tests.py
3357+++ b/tests/regressiontests/i18n/tests.py
3358@@ -1,72 +1,371 @@
3359-# coding: utf-8
3360-import misc
3361-
3362-regressions = ur"""
3363-Format string interpolation should work with *_lazy objects.
3364-
3365->>> from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3366->>> s = ugettext_lazy('Add %(name)s')
3367->>> d = {'name': 'Ringo'}
3368->>> s % d
3369-u'Add Ringo'
3370->>> activate('de')
3371->>> s % d
3372-u'Ringo hinzuf\xfcgen'
3373->>> activate('pl')
3374->>> s % d
3375-u'Dodaj Ringo'
3376->>> deactivate()
3377-
3378-It should be possible to compare *_lazy objects.
3379-
3380->>> s1 = ugettext_lazy('Add %(name)s')
3381->>> s == s1
3382-True
3383->>> s2 = gettext_lazy('Add %(name)s')
3384->>> s3 = gettext_lazy('Add %(name)s')
3385->>> s2 == s3
3386-True
3387->>> s == s2
3388-True
3389->>> s4 = ugettext_lazy('Some other string')
3390->>> s == s4
3391-False
3392-
3393-unicode(string_concat(...)) should not raise a TypeError - #4796
3394-
3395->>> import django.utils.translation
3396->>> reload(django.utils.translation)
3397-<module 'django.utils.translation' from ...>
3398->>> unicode(django.utils.translation.string_concat("dja", "ngo"))
3399-u'django'
3400-
3401-Translating a string requiring no auto-escaping shouldn't change the "safe"
3402-status.
3403-
3404->>> from django.utils.safestring import mark_safe, SafeString
3405->>> s = mark_safe('Password')
3406->>> type(s)
3407-<class 'django.utils.safestring.SafeString'>
3408->>> activate('de')
3409->>> type(ugettext(s))
3410-<class 'django.utils.safestring.SafeUnicode'>
3411->>> deactivate()
3412-
3413->>> SafeString('a') + s
3414-'aPassword'
3415->>> s + SafeString('a')
3416-'Passworda'
3417->>> s + mark_safe('a')
3418-'Passworda'
3419->>> mark_safe('a') + s
3420-'aPassword'
3421->>> mark_safe('a') + mark_safe('s')
3422-'as'
3423->>> print s
3424-Password
3425-"""
3426-
3427-__test__ = {
3428-    'regressions': regressions,
3429-    'misc': misc.tests,
3430-}
3431+import sys
3432+from django.test import TestCase, client
3433+from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3434+
3435+class TranslationTests(TestCase):
3436+
3437+    def test_lazy_objects(self):
3438+        """
3439+        Format string interpolation should work with *_lazy objects.
3440+        """
3441+        s = ugettext_lazy('Add %(name)s')
3442+        d = {'name': 'Ringo'}
3443+        self.assertEqual(u'Add Ringo', s % d)
3444+        activate('de')
3445+        self.assertEqual(u'Ringo hinzuf\xfcgen', s % d)
3446+        activate('pl')
3447+        self.assertEqual(u'Dodaj Ringo', s % d)
3448+        deactivate()
3449+
3450+        # It should be possible to compare *_lazy objects.
3451+        s1 = ugettext_lazy('Add %(name)s')
3452+        self.assertEqual(True, s == s1)
3453+        s2 = gettext_lazy('Add %(name)s')
3454+        s3 = gettext_lazy('Add %(name)s')
3455+        self.assertEqual(True, s2 == s3)
3456+        self.assertEqual(True, s == s2)
3457+        s4 = ugettext_lazy('Some other string')
3458+        self.assertEqual(False, s == s4)
3459+
3460+    def test_string_concat(self):
3461+        """
3462+        unicode(string_concat(...)) should not raise a TypeError - #4796
3463+        """
3464+        import django.utils.translation
3465+        self.assertEqual(django.utils.translation, reload(django.utils.translation))
3466+        self.assertEqual(u'django', unicode(django.utils.translation.string_concat("dja", "ngo")))
3467+
3468+    def test_safe_status(self):
3469+        """
3470+        Translating a string requiring no auto-escaping shouldn't change the "safe" status.
3471+        """
3472+        from django.utils.safestring import mark_safe, SafeString, SafeUnicode
3473+        s = mark_safe('Password')
3474+        self.assertEqual(SafeString, type(s))
3475+        activate('de')
3476+        self.assertEqual(SafeUnicode, type(ugettext(s)))
3477+        deactivate()
3478+        self.assertEqual('aPassword', SafeString('a') + s)
3479+        self.assertEqual('Passworda', s + SafeString('a'))
3480+        self.assertEqual('Passworda', s + mark_safe('a'))
3481+        self.assertEqual('aPassword', mark_safe('a') + s)
3482+        self.assertEqual('as', mark_safe('a') + mark_safe('s'))
3483+        #self.assertEqual(Password, print s)
3484+
3485+    def test_maclines(self):
3486+        """
3487+        Translations on files with mac or dos end of lines will be converted
3488+        to unix eof in .po catalogs, and they have to match when retrieved
3489+        """
3490+        from django.utils.translation.trans_real import translation
3491+        ca_translation = translation('ca')
3492+        ca_translation._catalog[u'Mac\nEOF\n'] = u'Catalan Mac\nEOF\n'
3493+        ca_translation._catalog[u'Win\nEOF\n'] = u'Catalan Win\nEOF\n'
3494+        activate('ca')
3495+        self.assertEqual(u'Catalan Mac\nEOF\n', ugettext(u'Mac\rEOF\r'))
3496+        self.assertEqual(u'Catalan Win\nEOF\n', ugettext(u'Win\r\nEOF\r\n'))
3497+        deactivate()
3498+
3499+    def test_dates_and_numbers(self):
3500+        """
3501+        Localization of dates and numbers
3502+        """
3503+        import datetime
3504+        import decimal
3505+        from django.conf import settings
3506+        from django.utils.formats import getformat, date_format, number_format, localize
3507+        from django.utils.numberformat import format
3508+        from django import template, forms
3509+        from django.forms.extras import SelectDateWidget
3510+
3511+        old_use_i18n = settings.USE_I18N
3512+        old_use_format_i18n = settings.USE_FORMAT_I18N
3513+        old_use_thousand_separator = settings.USE_THOUSAND_SEPARATOR
3514+
3515+        n = decimal.Decimal('66666.666')
3516+        f = 99999.999
3517+        d = datetime.date(2009, 12, 31)
3518+        dt = datetime.datetime(2009, 12, 31, 20, 50)
3519+        ctxt = template.Context({'n': n, 'd': d, 'dt': dt, 'f': f})
3520+
3521+        # Locale independent
3522+
3523+        class I18nForm(forms.Form):
3524+            decimal_field = forms.DecimalField()
3525+            float_field = forms.FloatField()
3526+            date_field = forms.DateField()
3527+            datetime_field = forms.DateTimeField()
3528+            time_field = forms.TimeField()
3529+
3530+        class SelectDateForm(forms.Form):
3531+            date_field = forms.DateField(widget=SelectDateWidget)
3532+
3533+        settings.USE_FORMAT_I18N = True
3534+        settings.USE_THOUSAND_SEPARATOR = False
3535+        self.assertEqual(u'66666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3536+        self.assertEqual(u'66666A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3537+
3538+        settings.USE_THOUSAND_SEPARATOR = True
3539+        self.assertEqual(u'66,666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3540+        self.assertEqual(u'6B6B6B6B6A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3541+        self.assertEqual(u'-66666.6', format(-66666.666, decimal_sep='.', decimal_pos=1))
3542+        self.assertEqual(u'-66666.0', format(int('-66666'), decimal_sep='.', decimal_pos=1))
3543+
3544+        # Catalan locale with format i18n disabled translations will be used, but not formats
3545+
3546+        settings.USE_FORMAT_I18N = False
3547+        activate('ca')
3548+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3549+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3550+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3551+        self.assertEqual(u'des. 31, 2009', date_format(d))
3552+        self.assertEqual(u'desembre 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3553+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3554+        self.assertEqual('No localizable', localize('No localizable'))
3555+        self.assertEqual(decimal.Decimal('66666.666'), localize(n))
3556+        self.assertEqual(99999.999, localize(f))
3557+        self.assertEqual(datetime.date(2009, 12, 31), localize(d))
3558+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), localize(dt))
3559+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3560+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3561+        self.assertEqual(u'2009-12-31', template.Template('{{ d }}').render(ctxt))
3562+        self.assertEqual(u'2009-12-31 20:50:00', template.Template('{{ dt }}').render(ctxt))
3563+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3564+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3565+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3566+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3567+
3568+        form = I18nForm({
3569+            'decimal_field': u'66666,666',
3570+            'float_field': u'99999,999',
3571+            'date_field': u'31/12/2009',
3572+            'datetime_field': u'31/12/2009 20:50',
3573+            'time_field': u'20:50'
3574+        })
3575+        self.assertEqual(False, form.is_valid())
3576+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['float_field'])
3577+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
3578+        self.assertEqual([u'Introdu\xefu una data v\xe0lida.'], form.errors['date_field'])
3579+        self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
3580+
3581+        form2 = SelectDateForm({
3582+            'date_field_month': u'12',
3583+            'date_field_day': u'31',
3584+            'date_field_year': u'2009'
3585+        })
3586+        self.assertEqual(True, form2.is_valid())
3587+        self.assertEqual(datetime.date(2009, 12, 31), form2.cleaned_data['date_field'])
3588+        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)))
3589+        deactivate()
3590+
3591+        # Catalan locale
3592+
3593+        settings.USE_FORMAT_I18N = True
3594+        activate('ca')
3595+        self.assertEqual('j \de F \de Y', getformat('DATE_FORMAT'))
3596+        self.assertEqual(1, getformat('FIRST_DAY_OF_WEEK'))
3597+        self.assertEqual(',', getformat('DECIMAL_SEPARATOR'))
3598+        self.assertEqual(u'31 de desembre de 2009', date_format(d))
3599+        self.assertEqual(u'desembre del 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3600+        self.assertEqual(u'31/12/2009 20:50', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3601+        self.assertEqual('No localizable', localize('No localizable'))
3602+
3603+        settings.USE_THOUSAND_SEPARATOR = True
3604+        self.assertEqual(u'66.666,666', localize(n))
3605+        self.assertEqual(u'99.999,999', localize(f))
3606+
3607+        settings.USE_THOUSAND_SEPARATOR = False
3608+        self.assertEqual(u'66666,666', localize(n))
3609+        self.assertEqual(u'99999,999', localize(f))
3610+        self.assertEqual(u'31 de desembre de 2009', localize(d))
3611+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', localize(dt))
3612+
3613+        settings.USE_THOUSAND_SEPARATOR = True
3614+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
3615+        self.assertEqual(u'99.999,999', template.Template('{{ f }}').render(ctxt))
3616+
3617+        settings.USE_THOUSAND_SEPARATOR = False
3618+        self.assertEqual(u'66666,666', template.Template('{{ n }}').render(ctxt))
3619+        self.assertEqual(u'99999,999', template.Template('{{ f }}').render(ctxt))
3620+        self.assertEqual(u'31 de desembre de 2009', template.Template('{{ d }}').render(ctxt))
3621+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', template.Template('{{ dt }}').render(ctxt))
3622+        self.assertEqual(u'66666,67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3623+        self.assertEqual(u'100000,0', template.Template('{{ f|floatformat }}').render(ctxt))
3624+        self.assertEqual(u'31/12/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3625+        self.assertEqual(u'31/12/2009 20:50', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3626+
3627+        form3 = I18nForm({
3628+            'decimal_field': u'66666,666',
3629+            'float_field': u'99999,999',
3630+            'date_field': u'31/12/2009',
3631+            'datetime_field': u'31/12/2009 20:50',
3632+            'time_field': u'20:50'
3633+        })
3634+        self.assertEqual(True, form3.is_valid())
3635+        self.assertEqual(decimal.Decimal('66666.666'), form3.cleaned_data['decimal_field'])
3636+        self.assertEqual(99999.999, form3.cleaned_data['float_field'])
3637+        self.assertEqual(datetime.date(2009, 12, 31), form3.cleaned_data['date_field'])
3638+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form3.cleaned_data['datetime_field'])
3639+        self.assertEqual(datetime.time(20, 50), form3.cleaned_data['time_field'])
3640+
3641+        form4 = SelectDateForm({
3642+            'date_field_month': u'12',
3643+            'date_field_day': u'31',
3644+            'date_field_year': u'2009'
3645+        })
3646+        self.assertEqual(True, form4.is_valid())
3647+        self.assertEqual(datetime.date(2009, 12, 31), form4.cleaned_data['date_field'])
3648+        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)))
3649+        deactivate()
3650+
3651+        # English locale
3652+
3653+        settings.USE_FORMAT_I18N = True
3654+        activate('en')
3655+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3656+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3657+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3658+        self.assertEqual(u'Dec. 31, 2009', date_format(d))
3659+        self.assertEqual(u'December 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3660+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3661+        self.assertEqual('No localizable', localize('No localizable'))
3662+
3663+        settings.USE_THOUSAND_SEPARATOR = True
3664+        self.assertEqual(u'66,666.666', localize(n))
3665+        self.assertEqual(u'99,999.999', localize(f))
3666+
3667+        settings.USE_THOUSAND_SEPARATOR = False
3668+        self.assertEqual(u'66666.666', localize(n))
3669+        self.assertEqual(u'99999.999', localize(f))
3670+        self.assertEqual(u'Dec. 31, 2009', localize(d))
3671+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', localize(dt))
3672+
3673+        settings.USE_THOUSAND_SEPARATOR = True
3674+        self.assertEqual(u'66,666.666', template.Template('{{ n }}').render(ctxt))
3675+        self.assertEqual(u'99,999.999', template.Template('{{ f }}').render(ctxt))
3676+
3677+        settings.USE_THOUSAND_SEPARATOR = False
3678+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3679+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3680+        self.assertEqual(u'Dec. 31, 2009', template.Template('{{ d }}').render(ctxt))
3681+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', template.Template('{{ dt }}').render(ctxt))
3682+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3683+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3684+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3685+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3686+
3687+        form5 = I18nForm({
3688+            'decimal_field': u'66666.666',
3689+            'float_field': u'99999.999',
3690+            'date_field': u'12/31/2009',
3691+            'datetime_field': u'12/31/2009 20:50',
3692+            'time_field': u'20:50'
3693+        })
3694+        self.assertEqual(True, form5.is_valid())
3695+        self.assertEqual(decimal.Decimal('66666.666'), form5.cleaned_data['decimal_field'])
3696+        self.assertEqual(99999.999, form5.cleaned_data['float_field'])
3697+        self.assertEqual(datetime.date(2009, 12, 31), form5.cleaned_data['date_field'])
3698+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form5.cleaned_data['datetime_field'])
3699+        self.assertEqual(datetime.time(20, 50), form5.cleaned_data['time_field'])
3700+
3701+        form6 = SelectDateForm({
3702+            'date_field_month': u'12',
3703+            'date_field_day': u'31',
3704+            'date_field_year': u'2009'
3705+        })
3706+        self.assertEqual(True, form6.is_valid())
3707+        self.assertEqual(datetime.date(2009, 12, 31), form6.cleaned_data['date_field'])
3708+        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)))
3709+        deactivate()
3710+
3711+        # Check if long locales work
3712+        activate('de-at')
3713+        settings.USE_THOUSAND_SEPARATOR = True
3714+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
3715+        deactivate()
3716+
3717+        # Restore defaults
3718+        settings.USE_I18N = old_use_i18n
3719+        settings.USE_FORMAT_I18N = old_use_format_i18n
3720+        settings.USE_THOUSAND_SEPARATOR = old_use_thousand_separator
3721+
3722+
3723+class MiscTests(TestCase):
3724+
3725+    def test_parse_spec_http_header(self):
3726+        """
3727+        Testing HTTP header parsing. First, we test that we can parse the
3728+        values according to the spec (and that we extract all the pieces in
3729+        the right order).
3730+        """
3731+        from django.utils.translation.trans_real import parse_accept_lang_header
3732+        p = parse_accept_lang_header
3733+        # Good headers.
3734+        self.assertEqual([('de', 1.0)], p('de'))
3735+        self.assertEqual([('en-AU', 1.0)], p('en-AU'))
3736+        self.assertEqual([('*', 1.0)], p('*;q=1.00'))
3737+        self.assertEqual([('en-AU', 0.123)], p('en-AU;q=0.123'))
3738+        self.assertEqual([('en-au', 0.10000000000000001)], p('en-au;q=0.1'))
3739+        self.assertEqual([('en-au', 1.0)], p('en-au;q=1.0'))
3740+        self.assertEqual([('da', 1.0), ('en', 0.5), ('en-gb', 0.25)], p('da, en-gb;q=0.25, en;q=0.5'))
3741+        self.assertEqual([('en-au-xx', 1.0)], p('en-au-xx'))
3742+        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'))
3743+        self.assertEqual([('*', 1.0)], p('*'))
3744+        self.assertEqual([('de', 1.0)], p('de;q=0.'))
3745+        self.assertEqual([], p(''))
3746+
3747+        # Bad headers; should always return [].
3748+        self.assertEqual([], p('en-gb;q=1.0000'))
3749+        self.assertEqual([], p('en;q=0.1234'))
3750+        self.assertEqual([], p('en;q=.2'))
3751+        self.assertEqual([], p('abcdefghi-au'))
3752+        self.assertEqual([], p('**'))
3753+        self.assertEqual([], p('en,,gb'))
3754+        self.assertEqual([], p('en-au;q=0.1.0'))
3755+        self.assertEqual([], p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en'))
3756+        self.assertEqual([], p('da, en-gb;q=0.8, en;q=0.7,#'))
3757+        self.assertEqual([], p('de;q=2.0'))
3758+        self.assertEqual([], p('de;q=0.a'))
3759+        self.assertEqual([], p(''))
3760+
3761+    def test_parse_literal_http_header(self):
3762+        """
3763+        Now test that we parse a literal HTTP header correctly.
3764+        """
3765+        from django.utils.translation.trans_real import get_language_from_request
3766+        g = get_language_from_request
3767+        from django.http import HttpRequest
3768+        r = HttpRequest
3769+        r.COOKIES = {}
3770+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3771+        self.assertEqual('pt-br', g(r))
3772+
3773+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3774+        self.assertEqual('pt', g(r))
3775+
3776+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3777+        self.assertEqual('es', g(r))
3778+
3779+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3780+        self.assertEqual('es-ar', g(r))
3781+
3782+        # Python 2.3 and 2.4 return slightly different results for completely
3783+        # bogus locales, so we omit this test for that anything below 2.4.
3784+        # It's relatively harmless in any cases (GIGO). This also means this
3785+        # won't be executed on Jython currently, but life's like that
3786+        # sometimes. (On those platforms, passing in a truly bogus locale
3787+        # will get you the default locale back.)
3788+        if sys.version_info >= (2, 5):
3789+            # This test assumes there won't be a Django translation to a US
3790+            # variation of the Spanish language, a safe assumption. When the
3791+            # user sets it as the preferred language, the main 'es'
3792+            # translation should be selected instead.
3793+            r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3794+            self.assertEqual(g(r), 'es')
3795+
3796+        # This tests the following scenario: there isn't a main language (zh)
3797+        # translation of Django but there is a translation to variation (zh_CN)
3798+        # the user sets zh-cn as the preferred language, it should be selected
3799+        # by Django without falling back nor ignoring it.
3800+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3801+        self.assertEqual(g(r), 'zh-cn')