Code

Ticket #7980: i18n-formatting.1.diff

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

Updated patch with relevant parts of i18n GSoC

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..c594762
2448--- /dev/null
2449+++ b/django/utils/formats.py
2450@@ -0,0 +1,95 @@
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' % (settings.FORMAT_MODULE_PATH, get_language()))
2468+        except ImportError:
2469+            pass
2470+    return None
2471+
2472+def django_formats_module():
2473+    """
2474+    Returns the formats module for the current locale, defined
2475+    on Django
2476+    """
2477+    try:
2478+        return import_module('.formats', 'django.conf.locale.%s' % get_language())
2479+    except ImportError:
2480+        return None
2481+
2482+def getformat(format_type):
2483+    """
2484+    For a specific format type, returns the format for the
2485+    current language (locale) defaulting to the format on settings.
2486+    format_type is the name of the format, for example 'DATE_FORMAT'
2487+    """
2488+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2489+        for module in (project_formats_module(), django_formats_module()):
2490+            if module:
2491+                try:
2492+                    return getattr(module, format_type)
2493+                except AttributeError:
2494+                    pass
2495+    return getattr(settings, format_type)
2496+
2497+def date_format(value, format=None):
2498+    """
2499+    Formats a datetime.date or datetime.datetime object using a
2500+    localizable format
2501+    """
2502+    return dateformat.format(value, getformat(format or 'DATE_FORMAT'))
2503+
2504+def number_format(value, decimal_pos=None):
2505+    """
2506+    Formats a numeric value using localization settings
2507+    """
2508+    return numberformat.format(
2509+        value,
2510+        getformat('DECIMAL_SEPARATOR'),
2511+        decimal_pos,
2512+        getformat('NUMBER_GROUPING'),
2513+        getformat('THOUSAND_SEPARATOR'),
2514+    )
2515+
2516+def localize(value, is_input=False):
2517+    """
2518+    Checks value, and if it has a localizable type (date,
2519+    number...) it returns the value as a string using
2520+    current locale format
2521+    """
2522+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
2523+        if isinstance(value, decimal.Decimal):
2524+            return number_format(value)
2525+        elif isinstance(value, float):
2526+            return number_format(value)
2527+        elif isinstance(value, int):
2528+            return number_format(value)
2529+        elif isinstance(value, datetime.datetime):
2530+            if not is_input:
2531+                return date_format(value, 'DATETIME_FORMAT')
2532+            else:
2533+                return value.strftime(getformat('DATETIME_INPUT_FORMATS')[0])
2534+        elif isinstance(value, datetime.date):
2535+            if not is_input:
2536+                return date_format(value)
2537+            else:
2538+                return value.strftime(getformat('DATE_INPUT_FORMATS')[0])
2539+        elif isinstance(value, datetime.time):
2540+            if not is_input:
2541+                return date_format(value, 'TIME_FORMAT')
2542+            else:
2543+                return value.strftime(getformat('TIME_INPUT_FORMATS')[0])
2544+    return value
2545+
2546diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
2547new file mode 100644
2548index 0000000..78ecb2f
2549--- /dev/null
2550+++ b/django/utils/numberformat.py
2551@@ -0,0 +1,42 @@
2552+from django.conf import settings
2553+
2554+def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
2555+    """
2556+    Gets a number (as a number or string), and returns it as a string,
2557+    using formats definied as arguments:
2558+
2559+    * decimal_sep: Decimal separator symbol (for example ".")
2560+    * decimal_pos: Number of decimal positions
2561+    * grouping: Number of digits in every group limited by thousand separator
2562+    * thousand_sep: Thousand separator symbol (for example ",")
2563+
2564+    """
2565+    # sign
2566+    if float(number) < 0:
2567+        sign = '-'
2568+    else:
2569+        sign = ''
2570+    # decimal part
2571+    str_number = unicode(number)
2572+    if str_number[0] == '-':
2573+        str_number = str_number[1:]
2574+    if '.' in str_number:
2575+        int_part, dec_part = str_number.split('.')
2576+        if decimal_pos:
2577+            dec_part = dec_part[:decimal_pos]
2578+    else:
2579+        int_part, dec_part = str_number, ''
2580+    if decimal_pos:
2581+        dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
2582+    if dec_part: dec_part = decimal_sep + dec_part
2583+    # grouping
2584+    if settings.USE_THOUSAND_SEPARATOR and grouping:
2585+        int_part_gd = ''
2586+        for cnt, digit in enumerate(int_part[::-1]):
2587+            if cnt and not cnt % grouping:
2588+                int_part_gd += thousand_sep
2589+            int_part_gd += digit
2590+        int_part = int_part_gd[::-1]
2591+
2592+    return sign + int_part + dec_part
2593+
2594diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py
2595index 98c6de6..7a57139 100644
2596--- a/django/utils/translation/trans_null.py
2597+++ b/django/utils/translation/trans_null.py
2598@@ -18,10 +18,10 @@ activate = lambda x: None
2599 deactivate = deactivate_all = lambda: None
2600 get_language = lambda: settings.LANGUAGE_CODE
2601 get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
2602-get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
2603-get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
2604 check_for_language = lambda x: True
2605 
2606+# date formats shouldn't be used using gettext anymore. This
2607+# is kept for backward compatibility
2608 TECHNICAL_ID_MAP = {
2609     "DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
2610     "DATE_FORMAT": settings.DATE_FORMAT,
2611@@ -51,3 +51,8 @@ def to_locale(language):
2612 
2613 def get_language_from_request(request):
2614     return settings.LANGUAGE_CODE
2615+
2616+# get_date_formats and get_partial_date_formats aren't used anymore from django
2617+# itself, and are kept for backward compatibility.
2618+get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
2619+get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
2620diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
2621index 48ed7cc..e9f0a36 100644
2622--- a/django/utils/translation/trans_real.py
2623+++ b/django/utils/translation/trans_real.py
2624@@ -266,15 +266,16 @@ def do_translate(message, translation_function):
2625     translation object to use. If no current translation is activated, the
2626     message will be run through the default translation object.
2627     """
2628+    eol_message = message.replace('\r\n', '\n').replace('\r', '\n')
2629     global _default, _active
2630     t = _active.get(currentThread(), None)
2631     if t is not None:
2632-        result = getattr(t, translation_function)(message)
2633+        result = getattr(t, translation_function)(eol_message)
2634     else:
2635         if _default is None:
2636             from django.conf import settings
2637             _default = translation(settings.LANGUAGE_CODE)
2638-        result = getattr(_default, translation_function)(message)
2639+        result = getattr(_default, translation_function)(eol_message)
2640     if isinstance(message, SafeData):
2641         return mark_safe(result)
2642     return result
2643@@ -389,39 +390,6 @@ def get_language_from_request(request):
2644 
2645     return settings.LANGUAGE_CODE
2646 
2647-def get_date_formats():
2648-    """
2649-    Checks whether translation files provide a translation for some technical
2650-    message ID to store date and time formats. If it doesn't contain one, the
2651-    formats provided in the settings will be used.
2652-    """
2653-    from django.conf import settings
2654-    date_format = ugettext('DATE_FORMAT')
2655-    datetime_format = ugettext('DATETIME_FORMAT')
2656-    time_format = ugettext('TIME_FORMAT')
2657-    if date_format == 'DATE_FORMAT':
2658-        date_format = settings.DATE_FORMAT
2659-    if datetime_format == 'DATETIME_FORMAT':
2660-        datetime_format = settings.DATETIME_FORMAT
2661-    if time_format == 'TIME_FORMAT':
2662-        time_format = settings.TIME_FORMAT
2663-    return date_format, datetime_format, time_format
2664-
2665-def get_partial_date_formats():
2666-    """
2667-    Checks whether translation files provide a translation for some technical
2668-    message ID to store partial date formats. If it doesn't contain one, the
2669-    formats provided in the settings will be used.
2670-    """
2671-    from django.conf import settings
2672-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2673-    month_day_format = ugettext('MONTH_DAY_FORMAT')
2674-    if year_month_format == 'YEAR_MONTH_FORMAT':
2675-        year_month_format = settings.YEAR_MONTH_FORMAT
2676-    if month_day_format == 'MONTH_DAY_FORMAT':
2677-        month_day_format = settings.MONTH_DAY_FORMAT
2678-    return year_month_format, month_day_format
2679-
2680 dot_re = re.compile(r'\S')
2681 def blankout(src, char):
2682     """
2683@@ -537,3 +505,42 @@ def parse_accept_lang_header(lang_string):
2684         result.append((lang, priority))
2685     result.sort(lambda x, y: -cmp(x[1], y[1]))
2686     return result
2687+
2688+# get_date_formats and get_partial_date_formats aren't used anymore from django
2689+# itself, and are kept for backward compatibility.
2690+# Note that it's also important to keep format names maked for translation, so
2691+# for compatibility we still want to have formats on translation catalogs. That
2692+# makes template code like {{ my_date|date:_('DATE_FORMAT') }} go on working
2693+def get_date_formats():
2694+    """
2695+    Checks whether translation files provide a translation for some technical
2696+    message ID to store date and time formats. If it doesn't contain one, the
2697+    formats provided in the settings will be used.
2698+    """
2699+    from django.conf import settings
2700+    date_format = ugettext('DATE_FORMAT')
2701+    datetime_format = ugettext('DATETIME_FORMAT')
2702+    time_format = ugettext('TIME_FORMAT')
2703+    if date_format == 'DATE_FORMAT':
2704+        date_format = settings.DATE_FORMAT
2705+    if datetime_format == 'DATETIME_FORMAT':
2706+        datetime_format = settings.DATETIME_FORMAT
2707+    if time_format == 'TIME_FORMAT':
2708+        time_format = settings.TIME_FORMAT
2709+    return date_format, datetime_format, time_format
2710+
2711+def get_partial_date_formats():
2712+    """
2713+    Checks whether translation files provide a translation for some technical
2714+    message ID to store partial date formats. If it doesn't contain one, the
2715+    formats provided in the settings will be used.
2716+    """
2717+    from django.conf import settings
2718+    year_month_format = ugettext('YEAR_MONTH_FORMAT')
2719+    month_day_format = ugettext('MONTH_DAY_FORMAT')
2720+    if year_month_format == 'YEAR_MONTH_FORMAT':
2721+        year_month_format = settings.YEAR_MONTH_FORMAT
2722+    if month_day_format == 'MONTH_DAY_FORMAT':
2723+        month_day_format = settings.MONTH_DAY_FORMAT
2724+    return year_month_format, month_day_format
2725+
2726diff --git a/django/views/i18n.py b/django/views/i18n.py
2727index 0280698..4bfbf5e 100644
2728--- a/django/views/i18n.py
2729+++ b/django/views/i18n.py
2730@@ -3,6 +3,7 @@ from django.conf import settings
2731 from django.utils import importlib
2732 from django.utils.translation import check_for_language, activate, to_locale, get_language
2733 from django.utils.text import javascript_quote
2734+from django.utils.formats import project_formats_module, django_formats_module
2735 import os
2736 import gettext as gettext_module
2737 
2738@@ -32,6 +33,25 @@ def set_language(request):
2739                 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
2740     return response
2741 
2742+def get_formats():
2743+    """
2744+    Returns an iterator over all formats in formats file
2745+    """
2746+    FORMAT_SETTINGS = ('DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT',
2747+        'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT',
2748+        'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR',
2749+        'THOUSAND_SEPARATOR', 'NUMBER_GROUPING')
2750+
2751+    result = {}
2752+    for module in (settings, django_formats_module(), project_formats_module()):
2753+        if module:
2754+            for attr in FORMAT_SETTINGS:
2755+                try:
2756+                    result[attr] = getattr(module, attr)
2757+                except AttributeError:
2758+                    pass
2759+    return result
2760+
2761 NullSource = """
2762 /* gettext identity library */
2763 
2764@@ -185,10 +205,13 @@ def javascript_catalog(request, domain='djangojs', packages=None):
2765         else:
2766             raise TypeError, k
2767     csrc.sort()
2768-    for k,v in pdict.items():
2769+    for k, v in pdict.items():
2770         src.append("catalog['%s'] = [%s];\n" % (javascript_quote(k), ','.join(["''"]*(v+1))))
2771+    for k, v in get_formats().items():
2772+        src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v))))
2773     src.extend(csrc)
2774     src.append(LibFoot)
2775     src.append(InterPolate)
2776     src = ''.join(src)
2777     return http.HttpResponse(src, 'text/javascript')
2778+
2779diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
2780index 8ff1509..1b57adf 100644
2781--- a/docs/ref/settings.txt
2782+++ b/docs/ref/settings.txt
2783@@ -288,12 +288,32 @@ DATE_FORMAT
2784 
2785 Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
2786 
2787-The default formatting to use for date fields on Django admin change-list
2788-pages -- and, possibly, by other parts of the system. See
2789-:ttag:`allowed date format strings <now>`.
2790+The default formatting to use for date fields in any part of the system.
2791+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2792+be applied. See :ttag:`allowed date format strings <now>`.
2793+
2794+See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.
2795+
2796+.. setting:: DATE_INPUT_FORMATS
2797 
2798-See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``
2799-and ``MONTH_DAY_FORMAT``.
2800+DATE_INPUT_FORMATS
2801+------------------
2802+
2803+Default::
2804+
2805+    ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
2806+    '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
2807+    '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
2808+
2809+A tuple of formats that will be accepted when inputting data on a date
2810+field. Formats will be tried in order, using the first valid.
2811+Note that these format strings are specified in Python's datetime_ module
2812+syntax, that is different from the one used by Django for formatting dates
2813+to be displayed.
2814+
2815+See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2816+
2817+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2818 
2819 .. setting:: DATETIME_FORMAT
2820 
2821@@ -302,12 +322,32 @@ DATETIME_FORMAT
2822 
2823 Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
2824 
2825-The default formatting to use for datetime fields on Django admin change-list
2826-pages -- and, possibly, by other parts of the system. See
2827-:ttag:`allowed date format strings <now>`.
2828+The default formatting to use for datetime fields in any part of the system.
2829+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2830+be applied. See :ttag:`allowed date format strings <now>`.
2831+
2832+See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2833 
2834-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
2835-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
2836+.. setting:: DATETIME_INPUT_FORMATS
2837+
2838+DATETIME_INPUT_FORMATS
2839+----------------------
2840+
2841+Default::
2842+
2843+    ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
2844+    '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
2845+    '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
2846+
2847+A tuple of formats that will be accepted when inputting data on a datetime
2848+field. Formats will be tried in order, using the first valid.
2849+Note that these format strings are specified in Python's datetime_ module
2850+syntax, that is different from the one used by Django for formatting dates
2851+to be displayed.
2852+
2853+See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
2854+
2855+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
2856 
2857 .. setting:: DEBUG
2858 
2859@@ -347,6 +387,14 @@ will be suppressed, and exceptions will propagate upwards.  This can
2860 be useful for some test setups, and should never be used on a live
2861 site.
2862 
2863+.. setting:: DECIMAL_SEPARATOR
2864+
2865+DECIMAL_SEPARATOR
2866+-----------------
2867+
2868+Default: ``'.'`` (Dot)
2869+
2870+Default decimal separator used when formatting decimal numbers.
2871 
2872 .. setting:: DEFAULT_CHARSET
2873 
2874@@ -596,6 +644,21 @@ system's standard umask.
2875 
2876 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
2877 
2878+.. setting:: FIRST_DAY_OF_WEEK
2879+
2880+FIRST_DAY_OF_WEEK
2881+-----------------
2882+
2883+Default: ``0`` (Sunday)
2884+
2885+Number representing the first day of the week. This is specially useful
2886+when displaying a calendar. This value is only used when not using
2887+format internationalization, or when a format cannot be found for the
2888+current locale.
2889+
2890+The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
2891+Monday and so on.
2892+
2893 .. setting:: FIXTURE_DIRS
2894 
2895 FIXTURE_DIRS
2896@@ -617,6 +680,34 @@ environment variable in any HTTP request. This setting can be used to override
2897 the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
2898 of the preferred value or not supplied at all.
2899 
2900+.. setting:: FORMAT_MODULE_PATH
2901+
2902+FORMAT_MODULE_PATH
2903+------------------
2904+
2905+Default: ``None``
2906+
2907+A full Python path to a Python package that contains format definitions for
2908+project locales. If not ``None``, Django will check for a ``formats.py``
2909+file, under the directory named as the current locale, and will use the
2910+formats defined on this file.
2911+
2912+For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and
2913+current language is ``en`` (English), Django will expect a directory tree
2914+like::
2915+
2916+    mysite/
2917+        formats/
2918+            __init__.py
2919+            en/
2920+                __init__.py
2921+                formats.py
2922+
2923+Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,
2924+``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,
2925+``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,
2926+``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
2927+
2928 .. setting:: IGNORABLE_404_ENDS
2929 
2930 IGNORABLE_404_ENDS
2931@@ -886,6 +977,21 @@ locales have different formats. For example, U.S. English would say
2932 See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
2933 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
2934 
2935+.. setting:: NUMBER_GROUPING
2936+
2937+NUMBER_GROUPING
2938+----------------
2939+
2940+Default: ``0``
2941+
2942+Number of digits grouped together on the integer part of a number. Common use
2943+is to display a thousand separator. If this setting is ``0``, then, no grouping
2944+will be applied to the number. If this setting is greater than ``0`` then the
2945+setting ``THOUSAND_SEPARATOR`` will be used as the separator between those
2946+groups.
2947+
2948+See also ``THOUSAND_SEPARATOR``
2949+
2950 .. setting:: PREPEND_WWW
2951 
2952 PREPEND_WWW
2953@@ -1077,6 +1183,32 @@ Default: ``False``
2954 Whether to save the session data on every request. See
2955 :ref:`topics-http-sessions`.
2956 
2957+.. setting:: SHORT_DATE_FORMAT
2958+
2959+SHORT_DATE_FORMAT
2960+-----------------
2961+
2962+Default: ``m/d/Y`` (e.g. ``12/31/2003``)
2963+
2964+An available formatting that can be used for date fields on templates.
2965+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2966+be applied. See :ttag:`allowed date format strings <now>`.
2967+
2968+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2969+
2970+.. setting:: SHORT_DATETIME_FORMAT
2971+
2972+SHORT_DATETIME_FORMAT
2973+---------------------
2974+
2975+Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
2976+
2977+An available formatting that can be used for datetime fields on templates.
2978+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
2979+be applied. See :ttag:`allowed date format strings <now>`.
2980+
2981+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
2982+
2983 .. setting:: SITE_ID
2984 
2985 SITE_ID
2986@@ -1231,6 +1363,18 @@ The name of the method to use for starting the test suite. See
2987 
2988 .. _Testing Django Applications: ../testing/
2989 
2990+.. setting:: THOUSAND_SEPARATOR
2991+
2992+THOUSAND_SEPARATOR
2993+------------------
2994+
2995+Default ``,`` (Comma)
2996+
2997+Default thousand separator used when formatting numbers. This setting is
2998+used only when ``NUMBER_GROUPPING`` is set.
2999+
3000+See also ``NUMBER_GROUPPING``, ``DECIMAL_SEPARATOR``
3001+
3002 .. setting:: TIME_FORMAT
3003 
3004 TIME_FORMAT
3005@@ -1238,12 +1382,28 @@ TIME_FORMAT
3006 
3007 Default: ``'P'`` (e.g. ``4 p.m.``)
3008 
3009-The default formatting to use for time fields on Django admin change-list
3010-pages -- and, possibly, by other parts of the system. See
3011-:ttag:`allowed date format strings <now>`.
3012+The default formatting to use for time fields in any part of the system.
3013+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
3014+be applied. See :ttag:`allowed date format strings <now>`.
3015 
3016-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
3017-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
3018+See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.
3019+
3020+.. setting:: TIME_INPUT_FORMATS
3021+
3022+TIME_INPUT_FORMATS
3023+------------------
3024+
3025+Default: ``('%H:%M:%S', '%H:%M')``
3026+
3027+A tuple of formats that will be accepted when inputting data on a time
3028+field. Formats will be tried in order, using the first valid.
3029+Note that these format strings are specified in Python's datetime_ module
3030+syntax, that is different from the one used by Django for formatting dates
3031+to be displayed.
3032+
3033+See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.
3034+
3035+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
3036 
3037 .. setting:: TIME_ZONE
3038 
3039@@ -1298,6 +1458,20 @@ A boolean that specifies whether to output the "Etag" header. This saves
3040 bandwidth but slows down performance. This is only used if ``CommonMiddleware``
3041 is installed (see :ref:`topics-http-middleware`).
3042 
3043+.. setting:: USE_FORMAT_I18N
3044+
3045+USE_FORMAT_I18N
3046+---------------
3047+
3048+Default ``False``
3049+
3050+A boolean that specifies if data will be localized by default or not. If this is
3051+set to ``True``, Django will display numbers and dates using the format of the
3052+current locale. It is required to set ``USE_I18N`` to ``True`` to allow data
3053+format localization.
3054+
3055+See also ``USE_I18N``
3056+
3057 .. setting:: USE_I18N
3058 
3059 USE_I18N
3060@@ -1310,6 +1484,22 @@ enabled. This provides an easy way to turn it off, for performance. If this is
3061 set to ``False``, Django will make some optimizations so as not to load the
3062 internationalization machinery.
3063 
3064+See also ``USE_FORMAT_I18N``
3065+
3066+.. setting:: USE_THOUSAND_SEPARATOR
3067+
3068+USE_THOUSAND_SEPARATOR
3069+----------------------
3070+
3071+Default ``False``
3072+
3073+A boolean that specifies wheter to display numbers using a thousand separator.
3074+If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``
3075+and ``NUMBER_GROUPING`` from current locale, to format the number.
3076+``USE_FORMAT_I18N`` must be set to ``True``, in order to format numbers.
3077+
3078+See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
3079+
3080 .. setting:: YEAR_MONTH_FORMAT
3081 
3082 YEAR_MONTH_FORMAT
3083diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
3084index bf2d9e8..29ccfef 100644
3085--- a/docs/ref/templates/builtins.txt
3086+++ b/docs/ref/templates/builtins.txt
3087@@ -1047,7 +1047,11 @@ If ``value`` is ``"String with spaces"``, the output will be ``"Stringwithspaces
3088 date
3089 ~~~~
3090 
3091-Formats a date according to the given format (same as the `now`_ tag).
3092+Formats a date according to the given format.
3093+
3094+Given format can be one of the predefined ones ``DATE_FORMAT``, ``DATETIME_FORMAT``,
3095+``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a custom format, same as the
3096+`now`_ tag. Note that prefedined formats vary depending on the current locale.
3097 
3098 For example::
3099 
3100@@ -1062,7 +1066,7 @@ When used without a format string::
3101     {{ value|date }}
3102 
3103 ...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
3104-used.
3105+used, without applying any localization.
3106 
3107 .. templatefilter:: default
3108 
3109@@ -1610,7 +1614,11 @@ output will be ``"Joel is a slug"``.
3110 time
3111 ~~~~
3112 
3113-Formats a time according to the given format (same as the `now`_ tag).
3114+Formats a time according to the given format.
3115+
3116+Given format can be the predefined one ``TIME_FORMAT``, or a custom format,
3117+same as the `now`_ tag. Note that the predefined format is locale depending.
3118+
3119 The time filter will only accept parameters in the format string that relate
3120 to the time of day, not the date (for obvious reasons). If you need to
3121 format a date, use the `date`_ filter.
3122@@ -1627,7 +1635,7 @@ When used without a format string::
3123     {{ value|time }}
3124 
3125 ...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
3126-used.
3127+used, without aplying any localization.
3128 
3129 .. templatefilter:: timesince
3130 
3131diff --git a/docs/topics/i18n.txt b/docs/topics/i18n.txt
3132index c5f4ab6..0fd2663 100644
3133--- a/docs/topics/i18n.txt
3134+++ b/docs/topics/i18n.txt
3135@@ -4,20 +4,21 @@
3136 Internationalization
3137 ====================
3138 
3139-Django has full support for internationalization of text in code and templates.
3140-Here's how it works.
3141+Django has full support for internationalization, including translation
3142+capabilities of text in code and templates, and format localization for
3143+dates and numbers. Here's how it works.
3144 
3145 Overview
3146 ========
3147 
3148 The goal of internationalization is to allow a single Web application to offer
3149-its content and functionality in multiple languages.
3150+its content and functionality in multiple languages and locales.
3151 
3152-You, the Django developer, can accomplish this goal by adding a minimal amount
3153-of hooks to your Python code and templates. These hooks are called
3154-**translation strings**. They tell Django: "This text should be translated into
3155-the end user's language, if a translation for this text is available in that
3156-language."
3157+For text translation, you, the Django developer, can accomplish this goal by
3158+adding a minimal amount of hooks to your Python code and templates. These hooks
3159+are called **translation strings**. They tell Django: "This text should be
3160+translated into the end user's language, if a translation for this text is
3161+available in that language."
3162 
3163 Django takes care of using these hooks to translate Web apps, on the fly,
3164 according to users' language preferences.
3165@@ -29,6 +30,12 @@ Essentially, Django does two things:
3166     * It uses these hooks to translate Web apps for particular users according
3167       to their language preferences.
3168 
3169+For format localization, it's just necessary to set
3170+:setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings file. If
3171+:settings:`USE_FORMAT_I18N` is set to ``True``, then Django will display
3172+numbers and dates in the format of the current locale. That includes field
3173+representation on templates, and allowed input formats on the admin.
3174+
3175 If you don't need internationalization in your app
3176 ==================================================
3177 
3178@@ -1074,3 +1081,53 @@ have been found to not support this command. Do not attempt to use Django
3179 translation utilities with a ``gettext`` package if the command ``xgettext
3180 --version`` entered at a Windows command prompt causes a popup window saying
3181 "xgettext.exe has generated errors and will be closed by Windows".
3182+
3183+Format localization
3184+===================
3185+
3186+Django's formatting system is disabled by default. To enable it, it's necessay
3187+to set :setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings
3188+file.  Note that :setting:`USE_FORMAT_I18N` requires `USE_I18N` to be ``True``.
3189+
3190+When using Django's formatting system, dates and numbers on templates will be
3191+displayed using the format specified for the current locale. That means, two
3192+users accessing the same content, but in different language, will see date and
3193+number fields formatted in different ways, depending on the format for their
3194+current locale.
3195+
3196+Django will also use localized formats when parsing data in forms. That means
3197+Django uses different formats for different locales when guessing the format
3198+used by the user when inputting data on forms. Note that Django uses different
3199+formats for displaying data, and for parsing it.
3200+
3201+Creating custom format files
3202+----------------------------
3203+
3204+Django provides format definitions for many locales, but sometimes you could
3205+want to create your own ones, because a format files doesn't exist for your
3206+locale, or because you want to overwrite some of the values.
3207+
3208+To use custom formats, first thing to do, is to specify the path where you'll
3209+place format files. To do that, just set :setting:`FORMAT_MODULE_PATH` setting
3210+to the the path (in the format ``'foo.bar.baz``) where format files will
3211+exists.
3212+
3213+Files are not placed directly in this directory, but in a directory named as
3214+the locale. File must be named ``formats.py``.
3215+
3216+For customazing English formats, a structure like this would be needed::
3217+
3218+    mysite/
3219+        formats/
3220+            __init__.py
3221+            en/
3222+                __init__.py
3223+                formats.py
3224+
3225+where :file:`formats.py` contains custom format definitions. For example::
3226+
3227+    THOUSAND_SEPARATOR = ' '
3228+
3229+to use a space as thousand separator, instead of the default for English,
3230+comma.
3231+
3232diff --git a/tests/regressiontests/i18n/misc.py b/tests/regressiontests/i18n/misc.py
3233deleted file mode 100644
3234index f8f35ad..0000000
3235--- a/tests/regressiontests/i18n/misc.py
3236+++ /dev/null
3237@@ -1,114 +0,0 @@
3238-import sys
3239-
3240-tests = """
3241->>> from django.utils.translation.trans_real import parse_accept_lang_header
3242->>> p = parse_accept_lang_header
3243-
3244-#
3245-# Testing HTTP header parsing. First, we test that we can parse the values
3246-# according to the spec (and that we extract all the pieces in the right order).
3247-#
3248-
3249-Good headers.
3250->>> p('de')
3251-[('de', 1.0)]
3252->>> p('en-AU')
3253-[('en-AU', 1.0)]
3254->>> p('*;q=1.00')
3255-[('*', 1.0)]
3256->>> p('en-AU;q=0.123')
3257-[('en-AU', 0.123)]
3258->>> p('en-au;q=0.1')
3259-[('en-au', 0.10000000000000001)]
3260->>> p('en-au;q=1.0')
3261-[('en-au', 1.0)]
3262->>> p('da, en-gb;q=0.25, en;q=0.5')
3263-[('da', 1.0), ('en', 0.5), ('en-gb', 0.25)]
3264->>> p('en-au-xx')
3265-[('en-au-xx', 1.0)]
3266->>> p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')
3267-[('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)]
3268->>> p('*')
3269-[('*', 1.0)]
3270->>> p('de;q=0.')
3271-[('de', 1.0)]
3272->>> p('')
3273-[]
3274-
3275-Bad headers; should always return [].
3276->>> p('en-gb;q=1.0000')
3277-[]
3278->>> p('en;q=0.1234')
3279-[]
3280->>> p('en;q=.2')
3281-[]
3282->>> p('abcdefghi-au')
3283-[]
3284->>> p('**')
3285-[]
3286->>> p('en,,gb')
3287-[]
3288->>> p('en-au;q=0.1.0')
3289-[]
3290->>> p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en')
3291-[]
3292->>> p('da, en-gb;q=0.8, en;q=0.7,#')
3293-[]
3294->>> p('de;q=2.0')
3295-[]
3296->>> p('de;q=0.a')
3297-[]
3298->>> p('')
3299-[]
3300-
3301-#
3302-# Now test that we parse a literal HTTP header correctly.
3303-#
3304-
3305->>> from django.utils.translation.trans_real import get_language_from_request
3306->>> g = get_language_from_request
3307->>> from django.http import HttpRequest
3308->>> r = HttpRequest
3309->>> r.COOKIES = {}
3310-
3311-These tests assumes the es, es_AR, pt and pt_BR translations exit in the Django
3312-source tree.
3313->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3314->>> g(r)
3315-'pt-br'
3316->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3317->>> g(r)
3318-'pt'
3319->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3320->>> g(r)
3321-'es'
3322->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3323->>> g(r)
3324-'es-ar'
3325-"""
3326-
3327-# Python 2.3 and 2.4 return slightly different results for completely bogus
3328-# locales, so we omit this test for that anything below 2.4. It's relatively
3329-# harmless in any cases (GIGO). This also means this won't be executed on
3330-# Jython currently, but life's like that sometimes. (On those platforms,
3331-# passing in a truly bogus locale will get you the default locale back.)
3332-if sys.version_info >= (2, 5):
3333-    tests += """
3334-This test assumes there won't be a Django translation to a US variation
3335-of the Spanish language, a safe assumption. When the user sets it
3336-as the preferred language, the main 'es' translation should be selected
3337-instead.
3338->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3339->>> g(r)
3340-'es'
3341-"""
3342-
3343-tests += """
3344-This tests the following scenario: there isn't a main language (zh)
3345-translation of Django but there is a translation to variation (zh_CN)
3346-the user sets zh-cn as the preferred language, it should be selected by
3347-Django without falling back nor ignoring it.
3348->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3349->>> g(r)
3350-'zh-cn'
3351-"""
3352diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
3353index 94e792c..67d1082 100644
3354--- a/tests/regressiontests/i18n/tests.py
3355+++ b/tests/regressiontests/i18n/tests.py
3356@@ -1,72 +1,365 @@
3357-# coding: utf-8
3358-import misc
3359-
3360-regressions = ur"""
3361-Format string interpolation should work with *_lazy objects.
3362-
3363->>> from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3364->>> s = ugettext_lazy('Add %(name)s')
3365->>> d = {'name': 'Ringo'}
3366->>> s % d
3367-u'Add Ringo'
3368->>> activate('de')
3369->>> s % d
3370-u'Ringo hinzuf\xfcgen'
3371->>> activate('pl')
3372->>> s % d
3373-u'Dodaj Ringo'
3374->>> deactivate()
3375-
3376-It should be possible to compare *_lazy objects.
3377-
3378->>> s1 = ugettext_lazy('Add %(name)s')
3379->>> s == s1
3380-True
3381->>> s2 = gettext_lazy('Add %(name)s')
3382->>> s3 = gettext_lazy('Add %(name)s')
3383->>> s2 == s3
3384-True
3385->>> s == s2
3386-True
3387->>> s4 = ugettext_lazy('Some other string')
3388->>> s == s4
3389-False
3390-
3391-unicode(string_concat(...)) should not raise a TypeError - #4796
3392-
3393->>> import django.utils.translation
3394->>> reload(django.utils.translation)
3395-<module 'django.utils.translation' from ...>
3396->>> unicode(django.utils.translation.string_concat("dja", "ngo"))
3397-u'django'
3398-
3399-Translating a string requiring no auto-escaping shouldn't change the "safe"
3400-status.
3401-
3402->>> from django.utils.safestring import mark_safe, SafeString
3403->>> s = mark_safe('Password')
3404->>> type(s)
3405-<class 'django.utils.safestring.SafeString'>
3406->>> activate('de')
3407->>> type(ugettext(s))
3408-<class 'django.utils.safestring.SafeUnicode'>
3409->>> deactivate()
3410-
3411->>> SafeString('a') + s
3412-'aPassword'
3413->>> s + SafeString('a')
3414-'Passworda'
3415->>> s + mark_safe('a')
3416-'Passworda'
3417->>> mark_safe('a') + s
3418-'aPassword'
3419->>> mark_safe('a') + mark_safe('s')
3420-'as'
3421->>> print s
3422-Password
3423-"""
3424-
3425-__test__ = {
3426-    'regressions': regressions,
3427-    'misc': misc.tests,
3428-}
3429+import sys
3430+from django.test import TestCase, client
3431+from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
3432+
3433+class TranslationTests(TestCase):
3434+
3435+    def test_lazy_objects(self):
3436+        """
3437+        Format string interpolation should work with *_lazy objects.
3438+        """
3439+        s = ugettext_lazy('Add %(name)s')
3440+        d = {'name': 'Ringo'}
3441+        self.assertEqual(u'Add Ringo', s % d)
3442+        activate('de')
3443+        self.assertEqual(u'Ringo hinzuf\xfcgen', s % d)
3444+        activate('pl')
3445+        self.assertEqual(u'Dodaj Ringo', s % d)
3446+        deactivate()
3447+
3448+        # It should be possible to compare *_lazy objects.
3449+        s1 = ugettext_lazy('Add %(name)s')
3450+        self.assertEqual(True, s == s1)
3451+        s2 = gettext_lazy('Add %(name)s')
3452+        s3 = gettext_lazy('Add %(name)s')
3453+        self.assertEqual(True, s2 == s3)
3454+        self.assertEqual(True, s == s2)
3455+        s4 = ugettext_lazy('Some other string')
3456+        self.assertEqual(False, s == s4)
3457+
3458+    def test_string_concat(self):
3459+        """
3460+        unicode(string_concat(...)) should not raise a TypeError - #4796
3461+        """
3462+        import django.utils.translation
3463+        self.assertEqual(django.utils.translation, reload(django.utils.translation))
3464+        self.assertEqual(u'django', unicode(django.utils.translation.string_concat("dja", "ngo")))
3465+
3466+    def test_safe_status(self):
3467+        """
3468+        Translating a string requiring no auto-escaping shouldn't change the "safe" status.
3469+        """
3470+        from django.utils.safestring import mark_safe, SafeString, SafeUnicode
3471+        s = mark_safe('Password')
3472+        self.assertEqual(SafeString, type(s))
3473+        activate('de')
3474+        self.assertEqual(SafeUnicode, type(ugettext(s)))
3475+        deactivate()
3476+        self.assertEqual('aPassword', SafeString('a') + s)
3477+        self.assertEqual('Passworda', s + SafeString('a'))
3478+        self.assertEqual('Passworda', s + mark_safe('a'))
3479+        self.assertEqual('aPassword', mark_safe('a') + s)
3480+        self.assertEqual('as', mark_safe('a') + mark_safe('s'))
3481+        #self.assertEqual(Password, print s)
3482+
3483+    def test_maclines(self):
3484+        """
3485+        Translations on files with mac or dos end of lines will be converted
3486+        to unix eof in .po catalogs, and they have to match when retrieved
3487+        """
3488+        from django.utils.translation.trans_real import translation
3489+        ca_translation = translation('ca')
3490+        ca_translation._catalog[u'Mac\nEOF\n'] = u'Catalan Mac\nEOF\n'
3491+        ca_translation._catalog[u'Win\nEOF\n'] = u'Catalan Win\nEOF\n'
3492+        activate('ca')
3493+        self.assertEqual(u'Catalan Mac\nEOF\n', ugettext(u'Mac\rEOF\r'))
3494+        self.assertEqual(u'Catalan Win\nEOF\n', ugettext(u'Win\r\nEOF\r\n'))
3495+        deactivate()
3496+
3497+    def test_dates_and_numbers(self):
3498+        """
3499+        Localization of dates and numbers
3500+        """
3501+        import datetime
3502+        import decimal
3503+        from django.conf import settings
3504+        from django.utils.formats import getformat, date_format, number_format, localize
3505+        from django.utils.numberformat import format
3506+        from django import template, forms
3507+        from django.forms.extras import SelectDateWidget
3508+
3509+        old_use_i18n = settings.USE_I18N
3510+        old_use_format_i18n = settings.USE_FORMAT_I18N
3511+        old_use_thousand_separator = settings.USE_THOUSAND_SEPARATOR
3512+
3513+        n = decimal.Decimal('66666.666')
3514+        f = 99999.999
3515+        d = datetime.date(2009, 12, 31)
3516+        dt = datetime.datetime(2009, 12, 31, 20, 50)
3517+        ctxt = template.Context({'n': n, 'd': d, 'dt': dt, 'f': f})
3518+
3519+        # Locale independent
3520+
3521+        class I18nForm(forms.Form):
3522+            decimal_field = forms.DecimalField()
3523+            float_field = forms.FloatField()
3524+            date_field = forms.DateField()
3525+            datetime_field = forms.DateTimeField()
3526+            time_field = forms.TimeField()
3527+
3528+        class SelectDateForm(forms.Form):
3529+            date_field = forms.DateField(widget=SelectDateWidget)
3530+
3531+        settings.USE_FORMAT_I18N = True
3532+        settings.USE_THOUSAND_SEPARATOR = False
3533+        self.assertEqual(u'66666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3534+        self.assertEqual(u'66666A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3535+
3536+        settings.USE_THOUSAND_SEPARATOR = True
3537+        self.assertEqual(u'66,666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
3538+        self.assertEqual(u'6B6B6B6B6A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
3539+        self.assertEqual(u'-66666.6', format(-66666.666, decimal_sep='.', decimal_pos=1))
3540+        self.assertEqual(u'-66666.0', format(int('-66666'), decimal_sep='.', decimal_pos=1))
3541+
3542+        # Catalan locale with format i18n disabled translations will be used, but not formats
3543+
3544+        settings.USE_FORMAT_I18N = False
3545+        activate('ca')
3546+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3547+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3548+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3549+        self.assertEqual(u'des. 31, 2009', date_format(d))
3550+        self.assertEqual(u'desembre 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3551+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3552+        self.assertEqual('No localizable', localize('No localizable'))
3553+        self.assertEqual(decimal.Decimal('66666.666'), localize(n))
3554+        self.assertEqual(99999.999, localize(f))
3555+        self.assertEqual(datetime.date(2009, 12, 31), localize(d))
3556+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), localize(dt))
3557+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3558+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3559+        self.assertEqual(u'2009-12-31', template.Template('{{ d }}').render(ctxt))
3560+        self.assertEqual(u'2009-12-31 20:50:00', template.Template('{{ dt }}').render(ctxt))
3561+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3562+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3563+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3564+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3565+
3566+        form = I18nForm({
3567+            'decimal_field': u'66666,666',
3568+            'float_field': u'99999,999',
3569+            'date_field': u'31/12/2009',
3570+            'datetime_field': u'31/12/2009 20:50',
3571+            'time_field': u'20:50'
3572+        })
3573+        self.assertEqual(False, form.is_valid())
3574+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['float_field'])
3575+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
3576+        self.assertEqual([u'Introdu\xefu una data v\xe0lida.'], form.errors['date_field'])
3577+        self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
3578+
3579+
3580+        form2 = SelectDateForm({
3581+            'date_field_month': u'12',
3582+            'date_field_day': u'31',
3583+            'date_field_year': u'2009'
3584+        })
3585+        self.assertEqual(True, form2.is_valid())
3586+        self.assertEqual(datetime.date(2009, 12, 31), form2.cleaned_data['date_field'])
3587+        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)))
3588+
3589+        # Catalan locale
3590+
3591+        settings.USE_FORMAT_I18N = True
3592+        activate('ca')
3593+        self.assertEqual('j \de F \de Y', getformat('DATE_FORMAT'))
3594+        self.assertEqual(1, getformat('FIRST_DAY_OF_WEEK'))
3595+        self.assertEqual(',', getformat('DECIMAL_SEPARATOR'))
3596+        self.assertEqual(u'31 de desembre de 2009', date_format(d))
3597+        self.assertEqual(u'desembre del 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3598+        self.assertEqual(u'31/12/2009 20:50', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3599+        self.assertEqual('No localizable', localize('No localizable'))
3600+
3601+        settings.USE_THOUSAND_SEPARATOR = True
3602+        self.assertEqual(u'66.666,666', localize(n))
3603+        self.assertEqual(u'99.999,999', localize(f))
3604+
3605+        settings.USE_THOUSAND_SEPARATOR = False
3606+        self.assertEqual(u'66666,666', localize(n))
3607+        self.assertEqual(u'99999,999', localize(f))
3608+        self.assertEqual(u'31 de desembre de 2009', localize(d))
3609+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', localize(dt))
3610+
3611+        settings.USE_THOUSAND_SEPARATOR = True
3612+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
3613+        self.assertEqual(u'99.999,999', template.Template('{{ f }}').render(ctxt))
3614+
3615+        settings.USE_THOUSAND_SEPARATOR = False
3616+        self.assertEqual(u'66666,666', template.Template('{{ n }}').render(ctxt))
3617+        self.assertEqual(u'99999,999', template.Template('{{ f }}').render(ctxt))
3618+        self.assertEqual(u'31 de desembre de 2009', template.Template('{{ d }}').render(ctxt))
3619+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', template.Template('{{ dt }}').render(ctxt))
3620+        self.assertEqual(u'66666,67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3621+        self.assertEqual(u'100000,0', template.Template('{{ f|floatformat }}').render(ctxt))
3622+        self.assertEqual(u'31/12/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3623+        self.assertEqual(u'31/12/2009 20:50', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3624+
3625+        form3 = I18nForm({
3626+            'decimal_field': u'66666,666',
3627+            'float_field': u'99999,999',
3628+            'date_field': u'31/12/2009',
3629+            'datetime_field': u'31/12/2009 20:50',
3630+            'time_field': u'20:50'
3631+        })
3632+        self.assertEqual(True, form3.is_valid())
3633+        self.assertEqual(decimal.Decimal('66666.666'), form3.cleaned_data['decimal_field'])
3634+        self.assertEqual(99999.999, form3.cleaned_data['float_field'])
3635+        self.assertEqual(datetime.date(2009, 12, 31), form3.cleaned_data['date_field'])
3636+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form3.cleaned_data['datetime_field'])
3637+        self.assertEqual(datetime.time(20, 50), form3.cleaned_data['time_field'])
3638+
3639+        form4 = SelectDateForm({
3640+            'date_field_month': u'12',
3641+            'date_field_day': u'31',
3642+            'date_field_year': u'2009'
3643+        })
3644+        self.assertEqual(True, form4.is_valid())
3645+        self.assertEqual(datetime.date(2009, 12, 31), form4.cleaned_data['date_field'])
3646+        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)))
3647+
3648+        # English locale
3649+
3650+        settings.USE_FORMAT_I18N = True
3651+        activate('en')
3652+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
3653+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
3654+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
3655+        self.assertEqual(u'Dec. 31, 2009', date_format(d))
3656+        self.assertEqual(u'December 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
3657+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
3658+        self.assertEqual('No localizable', localize('No localizable'))
3659+
3660+        settings.USE_THOUSAND_SEPARATOR = True
3661+        self.assertEqual(u'66,666.666', localize(n))
3662+        self.assertEqual(u'99,999.999', localize(f))
3663+
3664+        settings.USE_THOUSAND_SEPARATOR = False
3665+        self.assertEqual(u'66666.666', localize(n))
3666+        self.assertEqual(u'99999.999', localize(f))
3667+        self.assertEqual(u'Dec. 31, 2009', localize(d))
3668+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', localize(dt))
3669+
3670+        settings.USE_THOUSAND_SEPARATOR = True
3671+        self.assertEqual(u'66,666.666', template.Template('{{ n }}').render(ctxt))
3672+        self.assertEqual(u'99,999.999', template.Template('{{ f }}').render(ctxt))
3673+
3674+        settings.USE_THOUSAND_SEPARATOR = False
3675+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
3676+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
3677+        self.assertEqual(u'Dec. 31, 2009', template.Template('{{ d }}').render(ctxt))
3678+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', template.Template('{{ dt }}').render(ctxt))
3679+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
3680+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
3681+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
3682+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
3683+
3684+        form5 = I18nForm({
3685+            'decimal_field': u'66666.666',
3686+            'float_field': u'99999.999',
3687+            'date_field': u'12/31/2009',
3688+            'datetime_field': u'12/31/2009 20:50',
3689+            'time_field': u'20:50'
3690+        })
3691+        self.assertEqual(True, form5.is_valid())
3692+        self.assertEqual(decimal.Decimal('66666.666'), form5.cleaned_data['decimal_field'])
3693+        self.assertEqual(99999.999, form5.cleaned_data['float_field'])
3694+        self.assertEqual(datetime.date(2009, 12, 31), form5.cleaned_data['date_field'])
3695+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form5.cleaned_data['datetime_field'])
3696+        self.assertEqual(datetime.time(20, 50), form5.cleaned_data['time_field'])
3697+
3698+        form6 = SelectDateForm({
3699+            'date_field_month': u'12',
3700+            'date_field_day': u'31',
3701+            'date_field_year': u'2009'
3702+        })
3703+        self.assertEqual(True, form6.is_valid())
3704+        self.assertEqual(datetime.date(2009, 12, 31), form6.cleaned_data['date_field'])
3705+        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)))
3706+
3707+        # Restore defaults
3708+
3709+        settings.USE_I18N = old_use_i18n
3710+        settings.USE_FORMAT_I18N = old_use_format_i18n
3711+        settings.USE_THOUSAND_SEPARATOR = old_use_thousand_separator
3712+        deactivate()
3713+
3714+
3715+class MiscTests(TestCase):
3716+
3717+    def test_parse_spec_http_header(self):
3718+        """
3719+        Testing HTTP header parsing. First, we test that we can parse the
3720+        values according to the spec (and that we extract all the pieces in
3721+        the right order).
3722+        """
3723+        from django.utils.translation.trans_real import parse_accept_lang_header
3724+        p = parse_accept_lang_header
3725+        # Good headers.
3726+        self.assertEqual([('de', 1.0)], p('de'))
3727+        self.assertEqual([('en-AU', 1.0)], p('en-AU'))
3728+        self.assertEqual([('*', 1.0)], p('*;q=1.00'))
3729+        self.assertEqual([('en-AU', 0.123)], p('en-AU;q=0.123'))
3730+        self.assertEqual([('en-au', 0.10000000000000001)], p('en-au;q=0.1'))
3731+        self.assertEqual([('en-au', 1.0)], p('en-au;q=1.0'))
3732+        self.assertEqual([('da', 1.0), ('en', 0.5), ('en-gb', 0.25)], p('da, en-gb;q=0.25, en;q=0.5'))
3733+        self.assertEqual([('en-au-xx', 1.0)], p('en-au-xx'))
3734+        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'))
3735+        self.assertEqual([('*', 1.0)], p('*'))
3736+        self.assertEqual([('de', 1.0)], p('de;q=0.'))
3737+        self.assertEqual([], p(''))
3738+
3739+        # Bad headers; should always return [].
3740+        self.assertEqual([], p('en-gb;q=1.0000'))
3741+        self.assertEqual([], p('en;q=0.1234'))
3742+        self.assertEqual([], p('en;q=.2'))
3743+        self.assertEqual([], p('abcdefghi-au'))
3744+        self.assertEqual([], p('**'))
3745+        self.assertEqual([], p('en,,gb'))
3746+        self.assertEqual([], p('en-au;q=0.1.0'))
3747+        self.assertEqual([], p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en'))
3748+        self.assertEqual([], p('da, en-gb;q=0.8, en;q=0.7,#'))
3749+        self.assertEqual([], p('de;q=2.0'))
3750+        self.assertEqual([], p('de;q=0.a'))
3751+        self.assertEqual([], p(''))
3752+
3753+    def test_parse_literal_http_header(self):
3754+        """
3755+        Now test that we parse a literal HTTP header correctly.
3756+        """
3757+        from django.utils.translation.trans_real import get_language_from_request
3758+        g = get_language_from_request
3759+        from django.http import HttpRequest
3760+        r = HttpRequest
3761+        r.COOKIES = {}
3762+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
3763+        self.assertEqual('pt-br', g(r))
3764+
3765+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
3766+        self.assertEqual('pt', g(r))
3767+
3768+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
3769+        self.assertEqual('es', g(r))
3770+
3771+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
3772+        self.assertEqual('es-ar', g(r))
3773+
3774+        # Python 2.3 and 2.4 return slightly different results for completely
3775+        # bogus locales, so we omit this test for that anything below 2.4.
3776+        # It's relatively harmless in any cases (GIGO). This also means this
3777+        # won't be executed on Jython currently, but life's like that
3778+        # sometimes. (On those platforms, passing in a truly bogus locale
3779+        # will get you the default locale back.)
3780+        if sys.version_info >= (2, 5):
3781+            # This test assumes there won't be a Django translation to a US
3782+            # variation of the Spanish language, a safe assumption. When the
3783+            # user sets it as the preferred language, the main 'es'
3784+            # translation should be selected instead.
3785+            r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
3786+            self.assertEqual(g(r), 'es')
3787+
3788+        # This tests the following scenario: there isn't a main language (zh)
3789+        # translation of Django but there is a translation to variation (zh_CN)
3790+        # the user sets zh-cn as the preferred language, it should be selected
3791+        # by Django without falling back nor ignoring it.
3792+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
3793+        self.assertEqual(g(r), 'zh-cn')