diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 828aef5..b2b6963 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -103,6 +103,10 @@ USE_I18N = True
 LOCALE_PATHS = ()
 LANGUAGE_COOKIE_NAME = 'django_language'
 
+# If you set this to True, Django will format dates, numbers and calendars
+# according to user current locale
+USE_FORMAT_I18N = False
+
 # Not-necessarily-technical managers of the site. They get broken link
 # notifications and other various e-mails.
 MANAGERS = ADMINS
@@ -262,6 +266,12 @@ FILE_UPLOAD_TEMP_DIR = None
 # you'd pass directly to os.chmod; see http://docs.python.org/lib/os-file-dir.html.
 FILE_UPLOAD_PERMISSIONS = None
 
+# Python module path where user will place custom format definition.
+# The directory where this setting is pointing should contain subdirectories
+# named as the locales, containing a formats.py file
+# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use)
+FORMAT_MODULE_PATH = None
+
 # Default formatting for date objects. See all available format strings here:
 # http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
 DATE_FORMAT = 'N j, Y'
@@ -284,6 +294,72 @@ YEAR_MONTH_FORMAT = 'F Y'
 # http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
 MONTH_DAY_FORMAT = 'F j'
 
+# Default shortformatting for date objects. See all available format strings here:
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+SHORT_DATE_FORMAT = 'm/d/Y'
+
+# Default short formatting for datetime objects.
+# See all available format strings here:
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+SHORT_DATETIME_FORMAT = 'm/d/Y P'
+
+# Default formats tried to parse dates from input boxes
+# These formats are tried in the specified order
+# See all available format string here:
+# http://docs.python.org/library/datetime.html#strftime-behavior
+# * Note that these format strings are different from the ones to display dates
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
+)
+
+# Default formats tried to parse times from input boxes
+# These formats are tried in the specified order
+# See all available format string here:
+# http://docs.python.org/library/datetime.html#strftime-behavior
+# * Note that these format strings are different from the ones to display dates
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     # '14:30:59'
+    '%H:%M',        # '14:30'
+)
+
+# Default formats tried to parse dates and times from input boxes
+# These formats are tried in the specified order
+# See all available format string here:
+# http://docs.python.org/library/datetime.html#strftime-behavior
+# * Note that these format strings are different from the ones to display dates
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
+    '%m/%d/%Y',              # '10/25/2006'
+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
+    '%m/%d/%y',              # '10/25/06'
+)
+
+# First day of week, to be used on calendars
+# 0 means Sunday, 1 means Monday...
+FIRST_DAY_OF_WEEK = 0
+
+# Decimal separator symbol
+DECIMAL_SEPARATOR = '.'
+
+# Boolean that sets whether to add thousand separator when formatting numbers
+USE_THOUSAND_SEPARATOR = False
+
+# Number of digits that will be togheter, when spliting them by THOUSAND_SEPARATOR
+# 0 means no grouping, 3 means splitting by thousands...
+NUMBER_GROUPING = 0
+
+# Thousand separator symbol
+THOUSAND_SEPARATOR = ','
+
 # Do you want to manage transactions manually?
 # Hint: you really don't!
 TRANSACTIONS_MANAGED = False
diff --git a/django/conf/locale/__init__.py b/django/conf/locale/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ar/__init__.py b/django/conf/locale/ar/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ar/formats.py b/django/conf/locale/ar/formats.py
new file mode 100644
index 0000000..d8d627f
--- /dev/null
+++ b/django/conf/locale/ar/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F، Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd‏/m‏/Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/bg/__init__.py b/django/conf/locale/bg/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/bg/formats.py b/django/conf/locale/bg/formats.py
new file mode 100644
index 0000000..045543a
--- /dev/null
+++ b/django/conf/locale/bg/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/bn/__init__.py b/django/conf/locale/bn/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/bn/formats.py b/django/conf/locale/bn/formats.py
new file mode 100644
index 0000000..46e5da9
--- /dev/null
+++ b/django/conf/locale/bn/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F, Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ca/__init__.py b/django/conf/locale/ca/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ca/formats.py b/django/conf/locale/ca/formats.py
new file mode 100644
index 0000000..aebaea3
--- /dev/null
+++ b/django/conf/locale/ca/formats.py
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \de F \de Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j \de F \de Y \\a \le\s G:i'
+YEAR_MONTH_FORMAT = 'F \de\l Y'
+MONTH_DAY_FORMAT = 'j \de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+SHORT_DATETIME_FORMAT = 'd/m/Y G:i'
+FIRST_DAY_OF_WEEK = 1 # Monday
+DATE_INPUT_FORMATS = (
+    # '31/12/2009', '31/12/09'
+    '%d/%m/%Y', '%d/%m/%y'
+)
+TIME_INPUT_FORMATS = (
+    # '14:30:59', '14:30'
+    '%H:%M:%S', '%H:%M'
+)
+DATETIME_INPUT_FORMATS = (
+    '%d/%m/%Y %H:%M:%S',
+    '%d/%m/%Y %H:%M',
+    '%d/%m/%y %H:%M:%S',
+    '%d/%m/%y %H:%M',
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
+
diff --git a/django/conf/locale/cs/__init__.py b/django/conf/locale/cs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/cs/formats.py b/django/conf/locale/cs/formats.py
new file mode 100644
index 0000000..327e77e
--- /dev/null
+++ b/django/conf/locale/cs/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/cy/__init__.py b/django/conf/locale/cy/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/cy/formats.py b/django/conf/locale/cy/formats.py
new file mode 100644
index 0000000..a58d81f
--- /dev/null
+++ b/django/conf/locale/cy/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/da/__init__.py b/django/conf/locale/da/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/da/formats.py b/django/conf/locale/da/formats.py
new file mode 100644
index 0000000..9982014
--- /dev/null
+++ b/django/conf/locale/da/formats.py
@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i'
+DATETIME_FORMAT = 'j. F Y H:i'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
+FIRST_DAY_OF_WEEK = 1
+DATE_INPUT_FORMATS = (
+    '%d.%m.%Y', 			# '25.10.2006'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     			# '14:30:59'
+    '%H:%M',        			# '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%d.%m.%Y %H:%M:%S',     		# '25.10.2006 14:30:59'
+    '%d.%m.%Y %H:%M',    	    	# '25.10.2006 14:30'
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/de/__init__.py b/django/conf/locale/de/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/de/formats.py b/django/conf/locale/de/formats.py
new file mode 100644
index 0000000..89b5784
--- /dev/null
+++ b/django/conf/locale/de/formats.py
@@ -0,0 +1,32 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j. F Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
+FIRST_DAY_OF_WEEK = 1 # Monday
+DATE_INPUT_FORMATS = (
+    '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
+    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
+    '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S', # '14:30:59'
+    '%H:%M',    # '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
+    '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
+    '%d.%m.%Y',             # '25.10.2006'
+    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
+    '%Y-%m-%d',             # '2006-10-25'
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/el/__init__.py b/django/conf/locale/el/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/el/formats.py b/django/conf/locale/el/formats.py
new file mode 100644
index 0000000..d476ab3
--- /dev/null
+++ b/django/conf/locale/el/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/en/__init__.py b/django/conf/locale/en/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/en/formats.py b/django/conf/locale/en/formats.py
new file mode 100644
index 0000000..3a507cd
--- /dev/null
+++ b/django/conf/locale/en/formats.py
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'N j, Y'
+TIME_FORMAT = 'P'
+DATETIME_FORMAT = 'N j, Y, P'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'F j'
+SHORT_DATE_FORMAT = 'm/d/Y'
+SHORT_DATETIME_FORMAT = 'm/d/Y P'
+FIRST_DAY_OF_WEEK = 0 # Sunday
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     # '14:30:59'
+    '%H:%M',        # '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
+    '%m/%d/%Y',              # '10/25/2006'
+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
+    '%m/%d/%y',              # '10/25/06'
+)
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+NUMBER_GROUPING = 3
+
diff --git a/django/conf/locale/es/__init__.py b/django/conf/locale/es/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/es/formats.py b/django/conf/locale/es/formats.py
new file mode 100644
index 0000000..349810f
--- /dev/null
+++ b/django/conf/locale/es/formats.py
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \de F \de Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j \de F \de Y \a \l\a\s H:i'
+YEAR_MONTH_FORMAT = 'F \de Y'
+MONTH_DAY_FORMAT = 'j \de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
+FIRST_DAY_OF_WEEK = 1 # Monday
+DATE_INPUT_FORMATS = (
+    # '31/12/2009', '31/12/09'
+    '%d/%m/%Y', '%d/%m/%y'
+)
+TIME_INPUT_FORMATS = (
+    # '14:30:59', '14:30'
+    '%H:%M:%S', '%H:%M'
+)
+DATETIME_INPUT_FORMATS = (
+    '%d/%m/%Y %H:%M:%S',
+    '%d/%m/%Y %H:%M',
+    '%d/%m/%y %H:%M:%S',
+    '%d/%m/%y %H:%M',
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
+
diff --git a/django/conf/locale/es_AR/__init__.py b/django/conf/locale/es_AR/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/es_AR/formats.py b/django/conf/locale/es_AR/formats.py
new file mode 100644
index 0000000..6d71786
--- /dev/null
+++ b/django/conf/locale/es_AR/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT = 
+# TIME_FORMAT = 
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+# SHORT_DATE_FORMAT = 
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/et/__init__.py b/django/conf/locale/et/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/et/formats.py b/django/conf/locale/et/formats.py
new file mode 100644
index 0000000..b96420c
--- /dev/null
+++ b/django/conf/locale/et/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/eu/__init__.py b/django/conf/locale/eu/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/eu/formats.py b/django/conf/locale/eu/formats.py
new file mode 100644
index 0000000..475f924
--- /dev/null
+++ b/django/conf/locale/eu/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Yeko M\re\n d\a'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+SHORT_DATE_FORMAT = 'Y M j'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/fa/__init__.py b/django/conf/locale/fa/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/fa/formats.py b/django/conf/locale/fa/formats.py
new file mode 100644
index 0000000..dc11281
--- /dev/null
+++ b/django/conf/locale/fa/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j F Y، ساعت G:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'Y/n/j'
+SHORT_DATETIME_FORMAT = 'Y/n/j،‏ G:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/fi/__init__.py b/django/conf/locale/fi/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/fi/formats.py b/django/conf/locale/fi/formats.py
new file mode 100644
index 0000000..670e268
--- /dev/null
+++ b/django/conf/locale/fi/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G.i.s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/fr/__init__.py b/django/conf/locale/fr/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/fr/formats.py b/django/conf/locale/fr/formats.py
new file mode 100644
index 0000000..1d670d7
--- /dev/null
+++ b/django/conf/locale/fr/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j F Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y H:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ga/__init__.py b/django/conf/locale/ga/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ga/formats.py b/django/conf/locale/ga/formats.py
new file mode 100644
index 0000000..f177bb2
--- /dev/null
+++ b/django/conf/locale/ga/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/gl/__init__.py b/django/conf/locale/gl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/gl/formats.py b/django/conf/locale/gl/formats.py
new file mode 100644
index 0000000..e0a95d5
--- /dev/null
+++ b/django/conf/locale/gl/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/he/__init__.py b/django/conf/locale/he/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/he/formats.py b/django/conf/locale/he/formats.py
new file mode 100644
index 0000000..8d7c7f2
--- /dev/null
+++ b/django/conf/locale/he/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j בF Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j בF Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j בF'
+SHORT_DATE_FORMAT = 'd/m/Y'
+SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/hi/__init__.py b/django/conf/locale/hi/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/hi/formats.py b/django/conf/locale/hi/formats.py
new file mode 100644
index 0000000..6afa258
--- /dev/null
+++ b/django/conf/locale/hi/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd-m-Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/hr/__init__.py b/django/conf/locale/hr/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/hr/formats.py b/django/conf/locale/hr/formats.py
new file mode 100644
index 0000000..62d1a7e
--- /dev/null
+++ b/django/conf/locale/hr/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y.'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y.'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/hu/__init__.py b/django/conf/locale/hu/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/hu/formats.py b/django/conf/locale/hu/formats.py
new file mode 100644
index 0000000..6ee2db0
--- /dev/null
+++ b/django/conf/locale/hu/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y. F j.'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'F j.'
+SHORT_DATE_FORMAT = 'Y.m.d.'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/is/__init__.py b/django/conf/locale/is/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/is/formats.py b/django/conf/locale/is/formats.py
new file mode 100644
index 0000000..b6377db
--- /dev/null
+++ b/django/conf/locale/is/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/it/__init__.py b/django/conf/locale/it/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/it/formats.py b/django/conf/locale/it/formats.py
new file mode 100644
index 0000000..fe86b5b
--- /dev/null
+++ b/django/conf/locale/it/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd/M/Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ja/__init__.py b/django/conf/locale/ja/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ja/formats.py b/django/conf/locale/ja/formats.py
new file mode 100644
index 0000000..853056d
--- /dev/null
+++ b/django/conf/locale/ja/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y年n月j日'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'Y年n月j日G:i:s'
+YEAR_MONTH_FORMAT = 'Y年n月'
+MONTH_DAY_FORMAT = 'n月j日'
+SHORT_DATE_FORMAT = 'Y/m/d'
+SHORT_DATETIME_FORMAT = 'Y/m/d G:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ka/__init__.py b/django/conf/locale/ka/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ka/formats.py b/django/conf/locale/ka/formats.py
new file mode 100644
index 0000000..665a73f
--- /dev/null
+++ b/django/conf/locale/ka/formats.py
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'l, j F, Y'
+TIME_FORMAT = 'h:i:s a'
+DATETIME_FORMAT = 'j F, Y h:i:s a'
+YEAR_MONTH_FORMAT = 'F, Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j.M.Y'
+SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s'
+FIRST_DAY_OF_WEEK = 1 # (Monday)
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y',     # '2006-10-25', '10/25/2006', '10/25/06'
+    '%d %b %Y', '%d %b, %Y', '%d %b. %Y',   # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
+    '%d %B %Y', '%d %B, %Y',                # '25 October 2006', '25 October, 2006'
+    '%d.%m.%Y', '%d.%m.%y',                 # '25.10.2006', '25.10.06'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     # '14:30:59'
+    '%H:%M',        # '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%d.%m.%Y %H:%M:%S',     # '25.10.2006 14:30:59'
+    '%d.%m.%Y %H:%M',        # '25.10.2006 14:30'
+    '%d.%m.%Y',              # '25.10.2006'
+    '%d.%m.%y %H:%M:%S',     # '25.10.06 14:30:59'
+    '%d.%m.%y %H:%M',        # '25.10.06 14:30'
+    '%d.%m.%y',              # '25.10.06'
+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
+    '%m/%d/%Y',              # '10/25/2006'
+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
+    '%m/%d/%y',              # '10/25/06'
+)
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = " "
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/km/__init__.py b/django/conf/locale/km/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/km/formats.py b/django/conf/locale/km/formats.py
new file mode 100644
index 0000000..3736d57
--- /dev/null
+++ b/django/conf/locale/km/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j ខែ F ឆ្នាំ Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j ខែ F ឆ្នាំ Y, G:i:s'
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/kn/__init__.py b/django/conf/locale/kn/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/kn/formats.py b/django/conf/locale/kn/formats.py
new file mode 100644
index 0000000..fa7a7b9
--- /dev/null
+++ b/django/conf/locale/kn/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'h:i:s A'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ko/__init__.py b/django/conf/locale/ko/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ko/formats.py b/django/conf/locale/ko/formats.py
new file mode 100644
index 0000000..619047d
--- /dev/null
+++ b/django/conf/locale/ko/formats.py
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y년 n월 j일'
+TIME_FORMAT = 'A g:i:s'
+DATETIME_FORMAT = 'Y년 n월 j일 g:i:s A'
+YEAR_MONTH_FORMAT = 'Y년 F월'
+MONTH_DAY_FORMAT = 'F월 j일'
+SHORT_DATE_FORMAT = 'Y-n-j.'
+SHORT_DATETIME_FORMAT = 'Y-n-j H:i'
+# FIRST_DAY_OF_WEEK = 
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
+    '%Y년 %m월 %d일',                   # '2006년 10월 25일', with localized suffix.
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     # '14:30:59'
+    '%H:%M',        # '14:30'
+    '%H시 %M분 %S초',   # '14시 30분 59초'
+    '%H시 %M분',        # '14시 30분'
+)
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
+    '%m/%d/%Y',              # '10/25/2006'
+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
+    '%m/%d/%y',              # '10/25/06'
+
+    '%Y년 %m월 %d일 %H시 %M분 %S초',  # '2006년 10월 25일 14시 30분 59초'
+    '%Y년 %m월 %d일 %H시 %M분',       # '2006년 10월 25일 14시 30분'
+)
+
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/lt/__init__.py b/django/conf/locale/lt/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/lt/formats.py b/django/conf/locale/lt/formats.py
new file mode 100644
index 0000000..d9fb0c8
--- /dev/null
+++ b/django/conf/locale/lt/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y \m. F j \d.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+SHORT_DATE_FORMAT = 'Y.m.d'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/lv/__init__.py b/django/conf/locale/lv/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/lv/formats.py b/django/conf/locale/lv/formats.py
new file mode 100644
index 0000000..5dc211c
--- /dev/null
+++ b/django/conf/locale/lv/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y. \g\a\d\a j. F'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'Y. \g. F'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'Y. \g\a\d\a j. M'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/mk/__init__.py b/django/conf/locale/mk/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/mk/formats.py b/django/conf/locale/mk/formats.py
new file mode 100644
index 0000000..746ac0e
--- /dev/null
+++ b/django/conf/locale/mk/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+SHORT_DATE_FORMAT = 'd.n.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/nl/__init__.py b/django/conf/locale/nl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/nl/formats.py b/django/conf/locale/nl/formats.py
new file mode 100644
index 0000000..dcef8c1
--- /dev/null
+++ b/django/conf/locale/nl/formats.py
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'                   # '20 januari 2009'
+TIME_FORMAT = 'H:i'                     # '15:23'
+DATETIME_FORMAT = 'j F Y H:i'           # '20 januari 2009 15:23'
+YEAR_MONTH_FORMAT = 'F Y'               # 'januari 2009'
+MONTH_DAY_FORMAT = 'j F'                # '20 januari'
+SHORT_DATE_FORMAT = 'j-n-Y'             # '20-1-2009'
+SHORT_DATETIME_FORMAT = 'j-n-Y H:i'     # '20-1-2009 15:23'
+FIRST_DAY_OF_WEEK = 1                   # Monday (in Dutch 'maandag')
+DATE_INPUT_FORMATS = (
+    '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d', # '20-01-2009', '20-01-09', '2009-01-20'
+    '%d %b %Y', '%d %b %y',             # '20 jan 2009', '20 jan 09'
+    '%d %B %Y', '%d %B %y',             # '20 januari 2009', '20 januari 09'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',                         # '15:23:35'
+    '%H.%M:%S',                         # '15.23:35'
+    '%H.%M',                            # '15.23'
+    '%H:%M',                            # '15:23'
+)
+DATETIME_INPUT_FORMATS = (
+    # With time in %H:%M:%S :
+    '%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'
+    '%d %b %Y %H:%M:%S', '%d %b %y %H:%M:%S',   # '20 jan 2009 15:23:35', '20 jan 09 15:23:35'
+    '%d %B %Y %H:%M:%S', '%d %B %y %H:%M:%S',   # '20 januari 2009 15:23:35', '20 januari 2009 15:23:35'
+    # With time in %H.%M:%S :
+    '%d-%m-%Y %H.%M:%S', '%d-%m-%y %H.%M:%S',   # '20-01-2009 15.23:35', '20-01-09 15.23:35'
+    '%d %b %Y %H.%M:%S', '%d %b %y %H.%M:%S',   # '20 jan 2009 15.23:35', '20 jan 09 15.23:35'
+    '%d %B %Y %H.%M:%S', '%d %B %y %H.%M:%S',   # '20 januari 2009 15.23:35', '20 januari 2009 15.23:35'
+    # With time in %H:%M :
+    '%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'
+    '%d %b %Y %H:%M', '%d %b %y %H:%M',         # '20 jan 2009 15:23', '20 jan 09 15:23'
+    '%d %B %Y %H:%M', '%d %B %y %H:%M',         # '20 januari 2009 15:23', '20 januari 2009 15:23'
+    # With time in %H.%M :
+    '%d-%m-%Y %H.%M', '%d-%m-%y %H.%M',         # '20-01-2009 15.23', '20-01-09 15.23'
+    '%d %b %Y %H.%M', '%d %b %y %H.%M',         # '20 jan 2009 15.23', '20 jan 09 15.23'
+    '%d %B %Y %H.%M', '%d %B %y %H.%M',         # '20 januari 2009 15.23', '20 januari 2009 15.23'
+    # Without time :
+    '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d',         # '20-01-2009', '20-01-09', '2009-01-20'
+    '%d %b %Y', '%d %b %y',                     # '20 jan 2009', '20 jan 09'
+    '%d %B %Y', '%d %B %y',                     # '20 januari 2009', '20 januari 2009'
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/no/__init__.py b/django/conf/locale/no/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/no/formats.py b/django/conf/locale/no/formats.py
new file mode 100644
index 0000000..62ee886
--- /dev/null
+++ b/django/conf/locale/no/formats.py
@@ -0,0 +1,34 @@
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i'
+DATETIME_FORMAT = 'j. F Y H:i'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
+FIRST_DAY_OF_WEEK = 1 # Monday
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%j.%m.%Y', '%j.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
+    '%Y-%m-%j',                         # '2006-10-25', 
+    '%j. %b %Y', '%j %b %Y',            # '25. okt 2006', '25 okt 2006'
+    '%j. %b. %Y', '%j %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
+    '%j. %B %Y', '%j %B %Y',            # '25. oktober 2006', '25 oktober 2006'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%i:%S',     # '14:30:59'
+    '%H:%i',     # '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%i:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%i',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%Y-%m-%j',              # '2006-10-25'
+    '%j.%m.%Y %H:%i:%S',     # '25.10.2006 14:30:59'
+    '%j.%m.%Y %H:%i',        # '25.10.2006 14:30'
+    '%j.%m.%Y',              # '25.10.2006'
+    '%j.%m.%y %H:%i:%S',     # '25.10.06 14:30:59'
+    '%j.%m.%y %H:%i',        # '25.10.06 14:30'
+    '%j.%m.%y',              # '25.10.06'
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/pl/__init__.py b/django/conf/locale/pl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/pl/formats.py b/django/conf/locale/pl/formats.py
new file mode 100644
index 0000000..860a4a8
--- /dev/null
+++ b/django/conf/locale/pl/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd-m-Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/pt/__init__.py b/django/conf/locale/pt/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/pt/formats.py b/django/conf/locale/pt/formats.py
new file mode 100644
index 0000000..053a48a
--- /dev/null
+++ b/django/conf/locale/pt/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \de F \de Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F \de Y'
+MONTH_DAY_FORMAT = 'j \de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/pt_BR/__init__.py b/django/conf/locale/pt_BR/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/pt_BR/formats.py b/django/conf/locale/pt_BR/formats.py
new file mode 100644
index 0000000..f30d5c4
--- /dev/null
+++ b/django/conf/locale/pt_BR/formats.py
@@ -0,0 +1,35 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \\de N \\de Y'
+TIME_FORMAT = 'H:i'
+DATETIME_FORMAT = 'j \\de N \\de Y à\\s H:i'
+YEAR_MONTH_FORMAT = 'F \\de Y'
+MONTH_DAY_FORMAT = 'j \\de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
+FIRST_DAY_OF_WEEK = 0  # Sunday
+DATE_INPUT_FORMATS = (
+    '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
+    '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
+    '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
+)
+TIME_INPUT_FORMATS = (
+    '%H:%M:%S',     # '14:30:59'
+    '%H:%M',        # '14:30'
+)
+DATETIME_INPUT_FORMATS = (
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
+    '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
+    '%d/%m/%Y',              # '25/10/2006'
+    '%d/%m/%y %H:%M:%S',     # '25/10/06 14:30:59'
+    '%d/%m/%y %H:%M',        # '25/10/06 14:30'
+    '%d/%m/%y',              # '25/10/06'
+)
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+NUMBER_GROUPING = 3
diff --git a/django/conf/locale/ro/__init__.py b/django/conf/locale/ro/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ro/formats.py b/django/conf/locale/ro/formats.py
new file mode 100644
index 0000000..6d6e800
--- /dev/null
+++ b/django/conf/locale/ro/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j F Y, H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y, H:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ru/__init__.py b/django/conf/locale/ru/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ru/formats.py b/django/conf/locale/ru/formats.py
new file mode 100644
index 0000000..9a9ee96
--- /dev/null
+++ b/django/conf/locale/ru/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y г.'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/sk/__init__.py b/django/conf/locale/sk/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/sk/formats.py b/django/conf/locale/sk/formats.py
new file mode 100644
index 0000000..1bc3549
--- /dev/null
+++ b/django/conf/locale/sk/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/sl/__init__.py b/django/conf/locale/sl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/sl/formats.py b/django/conf/locale/sl/formats.py
new file mode 100644
index 0000000..4007f10
--- /dev/null
+++ b/django/conf/locale/sl/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd. F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j. M. Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/sr/__init__.py b/django/conf/locale/sr/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/sr/formats.py b/django/conf/locale/sr/formats.py
new file mode 100644
index 0000000..b1aaa77
--- /dev/null
+++ b/django/conf/locale/sr/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd. F Y.'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'Y F'
+MONTH_DAY_FORMAT = 'F j.'
+SHORT_DATE_FORMAT = 'd.m.Y.'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/sr_Latn/__init__.py b/django/conf/locale/sr_Latn/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py
new file mode 100644
index 0000000..6d71786
--- /dev/null
+++ b/django/conf/locale/sr_Latn/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT = 
+# TIME_FORMAT = 
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+# SHORT_DATE_FORMAT = 
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/sv/__init__.py b/django/conf/locale/sv/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/sv/formats.py b/django/conf/locale/sv/formats.py
new file mode 100644
index 0000000..df4e633
--- /dev/null
+++ b/django/conf/locale/sv/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'Y F'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/ta/__init__.py b/django/conf/locale/ta/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/ta/formats.py b/django/conf/locale/ta/formats.py
new file mode 100644
index 0000000..69fa17d
--- /dev/null
+++ b/django/conf/locale/ta/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F, Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/te/__init__.py b/django/conf/locale/te/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/te/formats.py b/django/conf/locale/te/formats.py
new file mode 100644
index 0000000..e805872
--- /dev/null
+++ b/django/conf/locale/te/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/th/__init__.py b/django/conf/locale/th/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/th/formats.py b/django/conf/locale/th/formats.py
new file mode 100644
index 0000000..7091dc6
--- /dev/null
+++ b/django/conf/locale/th/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j F Y, G:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/tr/__init__.py b/django/conf/locale/tr/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/tr/formats.py b/django/conf/locale/tr/formats.py
new file mode 100644
index 0000000..b978788
--- /dev/null
+++ b/django/conf/locale/tr/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'd F'
+SHORT_DATE_FORMAT = 'd M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/uk/__init__.py b/django/conf/locale/uk/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/uk/formats.py b/django/conf/locale/uk/formats.py
new file mode 100644
index 0000000..8e41bf0
--- /dev/null
+++ b/django/conf/locale/uk/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y р.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT = 
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/zh_CN/__init__.py b/django/conf/locale/zh_CN/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/zh_CN/formats.py b/django/conf/locale/zh_CN/formats.py
new file mode 100644
index 0000000..6d71786
--- /dev/null
+++ b/django/conf/locale/zh_CN/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT = 
+# TIME_FORMAT = 
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+# SHORT_DATE_FORMAT = 
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/conf/locale/zh_TW/__init__.py b/django/conf/locale/zh_TW/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/conf/locale/zh_TW/formats.py b/django/conf/locale/zh_TW/formats.py
new file mode 100644
index 0000000..6d71786
--- /dev/null
+++ b/django/conf/locale/zh_TW/formats.py
@@ -0,0 +1,18 @@
+# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT = 
+# TIME_FORMAT = 
+# DATETIME_FORMAT = 
+# YEAR_MONTH_FORMAT = 
+# MONTH_DAY_FORMAT = 
+# SHORT_DATE_FORMAT = 
+# SHORT_DATETIME_FORMAT = 
+# FIRST_DAY_OF_WEEK = 
+# DATE_INPUT_FORMATS = 
+# TIME_INPUT_FORMATS = 
+# DATETIME_INPUT_FORMATS = 
+# DECIMAL_SEPARATOR = 
+# THOUSAND_SEPARATOR = 
+# NUMBER_GROUPING = 
diff --git a/django/contrib/admin/media/js/calendar.js b/django/contrib/admin/media/js/calendar.js
index 9035176..3f57145 100644
--- a/django/contrib/admin/media/js/calendar.js
+++ b/django/contrib/admin/media/js/calendar.js
@@ -25,6 +25,7 @@ function quickElement() {
 var CalendarNamespace = {
     monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
     daysOfWeek: gettext('S M T W T F S').split(' '),
+    firstDayOfWeek: parseInt(gettext('FIRST_DAY_OF_WEEK')),
     isLeapYear: function(year) {
         return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
     },
@@ -56,10 +57,10 @@ var CalendarNamespace = {
         // Draw days-of-week header
         var tableRow = quickElement('tr', tableBody);
         for (var i = 0; i < 7; i++) {
-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]);
+            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
         }
 
-        var startingPos = new Date(year, month-1, 1).getDay();
+        var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
         var days = CalendarNamespace.getDaysInMonth(month, year);
 
         // Draw blanks before first of month
diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html
index 38b1c34..9e6223a 100644
--- a/django/contrib/admin/templates/admin/object_history.html
+++ b/django/contrib/admin/templates/admin/object_history.html
@@ -27,7 +27,7 @@
         <tbody>
         {% for action in action_list %}
         <tr>
-            <th scope="row">{{ action.action_time|date:_("DATETIME_FORMAT") }}</th>
+            <th scope="row">{{ action.action_time|date }}</th>
             <td>{{ action.user.username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}</td>
             <td>{{ action.change_message }}</td>
         </tr>
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 5a02ab0..cd05957 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -3,11 +3,11 @@ from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
 from django.core.exceptions import ObjectDoesNotExist
 from django.db import models
-from django.utils import dateformat
+from django.utils import formats
 from django.utils.html import escape, conditional_escape
 from django.utils.text import capfirst
 from django.utils.safestring import mark_safe
-from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
+from django.utils.translation import ugettext as _
 from django.utils.encoding import smart_unicode, smart_str, force_unicode
 from django.template import Library
 import datetime
@@ -189,25 +189,24 @@ def items_for_result(cl, result, form):
             # Dates and times are special: They're formatted in a certain way.
             elif isinstance(f, models.DateField) or isinstance(f, models.TimeField):
                 if field_val:
-                    (date_format, datetime_format, time_format) = get_date_formats()
-                    if isinstance(f, models.DateTimeField):
-                        result_repr = capfirst(dateformat.format(field_val, datetime_format))
-                    elif isinstance(f, models.TimeField):
-                        result_repr = capfirst(dateformat.time_format(field_val, time_format))
-                    else:
-                        result_repr = capfirst(dateformat.format(field_val, date_format))
+                    result_repr = formats.localize(field_val)
+                else:
+                    result_repr = EMPTY_CHANGELIST_VALUE
+            elif isinstance(f, models.DecimalField):
+                if field_val:
+                    result_repr = formats.number_format(field_val, f.decimal_places)
+                else:
+                    result_repr = EMPTY_CHANGELIST_VALUE
+                row_class = ' class="nowrap"'
+            elif isinstance(f, models.FloatField):
+                if field_val:
+                    result_repr = formats.number_format(field_val)
                 else:
                     result_repr = EMPTY_CHANGELIST_VALUE
                 row_class = ' class="nowrap"'
             # Booleans are special: We use images.
             elif isinstance(f, models.BooleanField) or isinstance(f, models.NullBooleanField):
                 result_repr = _boolean_icon(field_val)
-            # DecimalFields are special: Zero-pad the decimals.
-            elif isinstance(f, models.DecimalField):
-                if field_val is not None:
-                    result_repr = ('%%.%sf' % f.decimal_places) % field_val
-                else:
-                    result_repr = EMPTY_CHANGELIST_VALUE
             # Fields with choices are special: Use the representation
             # of the choice.
             elif f.flatchoices:
@@ -268,7 +267,6 @@ def date_hierarchy(cl):
         year_lookup = cl.params.get(year_field)
         month_lookup = cl.params.get(month_field)
         day_lookup = cl.params.get(day_field)
-        year_month_format, month_day_format = get_partial_date_formats()
 
         link = lambda d: cl.get_query_string(d, [field_generic])
 
@@ -278,9 +276,9 @@ def date_hierarchy(cl):
                 'show': True,
                 'back': {
                     'link': link({year_field: year_lookup, month_field: month_lookup}),
-                    'title': dateformat.format(day, year_month_format)
+                    'title': capfirst(formats.date_format(day, 'YEAR_MONTH_FORMAT'))
                 },
-                'choices': [{'title': dateformat.format(day, month_day_format)}]
+                'choices': [{'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))}]
             }
         elif year_lookup and month_lookup:
             days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')
@@ -292,7 +290,7 @@ def date_hierarchy(cl):
                 },
                 'choices': [{
                     'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),
-                    'title': dateformat.format(day, month_day_format)
+                    'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))
                 } for day in days]
             }
         elif year_lookup:
@@ -305,7 +303,7 @@ def date_hierarchy(cl):
                 },
                 'choices': [{
                     'link': link({year_field: year_lookup, month_field: month.month}),
-                    'title': dateformat.format(month, year_month_format)
+                    'title': capfirst(formats.date_format(month, 'YEAR_MONTH_FORMAT'))
                 } for month in months]
             }
         else:
diff --git a/django/contrib/databrowse/datastructures.py b/django/contrib/databrowse/datastructures.py
index 5fdbdbe..369f825 100644
--- a/django/contrib/databrowse/datastructures.py
+++ b/django/contrib/databrowse/datastructures.py
@@ -4,9 +4,8 @@ convenience functionality and permalink functions for the databrowse app.
 """
 
 from django.db import models
-from django.utils import dateformat
+from django.utils import formats
 from django.utils.text import capfirst
-from django.utils.translation import get_date_formats
 from django.utils.encoding import smart_unicode, smart_str, iri_to_uri
 from django.utils.safestring import mark_safe
 from django.db.models.query import QuerySet
@@ -156,13 +155,12 @@ class EasyInstanceField(object):
             objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
         elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
             if self.raw_value:
-                date_format, datetime_format, time_format = get_date_formats()
                 if isinstance(self.field, models.DateTimeField):
-                    objs = capfirst(dateformat.format(self.raw_value, datetime_format))
+                    objs = capfirst(formats.date_format(self.raw_value, 'DATETIME_FORMAT'))
                 elif isinstance(self.field, models.TimeField):
-                    objs = capfirst(dateformat.time_format(self.raw_value, time_format))
+                    objs = capfirst(formats.date_format(self.raw_value, 'TIME_FORMAT'))
                 else:
-                    objs = capfirst(dateformat.format(self.raw_value, date_format))
+                    objs = capfirst(formats.date_format(self.raw_value, 'DATE_FORMAT'))
             else:
                 objs = EMPTY_VALUE
         elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
diff --git a/django/core/management/commands/importcldr.py b/django/core/management/commands/importcldr.py
new file mode 100644
index 0000000..c4a13e6
--- /dev/null
+++ b/django/core/management/commands/importcldr.py
@@ -0,0 +1,221 @@
+import sys
+import os
+import re
+from optparse import make_option, OptionParser
+
+from django.core.management.base import LabelCommand, CommandError
+
+try:
+    from lxml import etree
+except ImportError:
+    raise CommandError('You need to install `python-lxml` to run this script')
+
+FORMATS_FILE_NAME = 'formats.py'
+FORMATS_FILE_HEADER = '''# -*- encoding: utf-8 -*-
+# This file is distributed under the same license as the Django package.
+#
+
+'''
+
+def quote(nodes, name,  locale, previous):
+    if len(nodes):
+        return "'%s'" % unicode(nodes[0].text).replace("'", "\\'")
+    else:
+        return None
+
+def convert_time(nodes, name,  locale, previous):
+    SPECIAL_CHARS = ('a', 'A', 'b', 'B', 'd', 'D', 'f', 'F', 'g', 'G', 'h',
+        'H', 'i', 'I', 'j', 'l', 'L', 'm', 'M', 'n', 'N', 'O', 'P', 'r',
+        's', 'S', 't', 'T', 'U', 'w', 'W', 'y', 'Y', 'z', 'Z')
+    FORMAT_STR_MAP = ( # not using a dict, because we have to apply formats in order
+        ('dd', 'd'),
+        ('d', 'j'),
+        ('MMMM', 'F'),
+        ('MMM', 'M'),
+        ('MM', 'm'),
+        ('M', 'n'),
+        ('yyyy', 'Y'),
+        ('yy', 'y'),
+        ('y', 'Y'),
+        ('hh', 'h'),
+        ('h', 'g'),
+        ('HH', 'H'),
+        ('H', 'G'),
+        ('mm', 'i'),
+        ('ss', 's'),
+        ('a', 'A'),
+        ('LLLL', 'F'),
+    )
+    if len(nodes):
+        original = nodes[0].text
+        result = ''
+        for cnt, segment in enumerate(original.split("'")):
+            if cnt % 2:
+                for char in SPECIAL_CHARS:
+                    segment = segment.replace(char, '\\%s' % char)
+                result += segment
+            else:
+                while segment:
+                    found = False
+                    for src, dst in FORMAT_STR_MAP:
+                        if segment[0:len(src)] == src:
+                            result += dst
+                            segment = segment[len(src):]
+                            found = True
+                            break
+                    if not found:
+                        result += segment[0]
+                        segment = segment[1:]
+
+        return "'%s'" % result
+    else:
+        return None
+
+def datetime(nodes, name, locale, previous):
+    result = None
+    if len(nodes) and 'DATE_FORMAT' in previous and 'TIME_FORMAT' in previous:
+        result = nodes[0].text
+        result = result.replace('{0}', previous['TIME_FORMAT'][1:-1])
+        if name == 'SHORT_DATETIME_FORMAT' and 'SHORT_DATE_FORMAT' in previous:
+            result = result.replace('{1}', previous['SHORT_DATE_FORMAT'][1:-1])
+        else:
+            result = result.replace('{1}', previous['DATE_FORMAT'][1:-1])
+    if result:
+        return "'%s'" % result
+    else:
+        return None
+
+FORMATS_MAP = [
+    {
+        'name': 'DATE_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='long']/dateFormat/pattern",
+        'conversion': convert_time,
+    },
+    {
+        'name': 'TIME_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/timeFormats/timeFormatLength[@type='medium']/timeFormat/pattern",
+        'conversion': convert_time,
+    },
+    {
+        'name': 'DATETIME_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='long']/dateTimeFormat/pattern",
+        'conversion': datetime,
+    },
+    {
+        'name': 'YEAR_MONTH_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='yMMMM']",
+        'conversion': convert_time,
+    },
+    {
+        'name': 'MONTH_DAY_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='MMMMd']",
+        'conversion': convert_time,
+    },
+    {
+        'name': 'SHORT_DATE_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='medium']/dateFormat/pattern",
+        'conversion': convert_time,
+    },
+    {
+        'name': 'SHORT_DATETIME_FORMAT',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='short']/dateTimeFormat/pattern",
+        'conversion': datetime,
+    },
+    {'name': 'FIRST_DAY_OF_WEEK'},
+    {'name': 'DATE_INPUT_FORMATS'},
+    {'name': 'TIME_INPUT_FORMATS'},
+    {'name': 'DATETIME_INPUT_FORMATS'},
+    {
+        'name': 'DECIMAL_SEPARATOR',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/numbers/symbols/decimal",
+        'conversion': quote,
+    },
+    {
+        'name': 'THOUSAND_SEPARATOR',
+        'file': os.path.join('common', 'main', '%(locale)s.xml'),
+        'pattern': "/ldml/numbers/symbols/group",
+        'conversion': quote,
+    },
+    {'name': 'NUMBER_GROUPING'},
+]
+"""
+"""
+
+def get_locales(django_locale_dir, locale=None):
+    if locale:
+        yield locale
+    else:
+        locale_re = re.compile('[a-z]{2}(_[A-Z]{2})?')
+        for locale in os.listdir(django_locale_dir):
+            if locale_re.match(locale):
+                yield locale
+
+def import_cldr(cldr_dir, locale=None, overwrite=False):
+    """
+    For every locale defined in Django, get from the CLDR locale file all
+    settings defined in output_structure, and write the result to the 
+    locale directories on Django.
+    """
+    if not os.path.isdir(cldr_dir):
+        raise Exception, "Specified CLDR directory '%s' does not exist" % cldr_dir
+
+    import django
+    django_locale_dir = os.path.join(os.path.dirname(django.__file__), 'conf', 'locale')
+
+    for locale in get_locales(django_locale_dir, locale):
+        output_filename = os.path.join(django_locale_dir, locale, FORMATS_FILE_NAME)
+        if os.path.isfile(output_filename) and not overwrite:
+            print "'%s' locale already exists. Skipping" % locale
+        else:
+            result = {}
+            output_file = open(output_filename, 'w')
+            output_file.write(FORMATS_FILE_HEADER)
+            for format in FORMATS_MAP:
+                if 'file' in format:
+                    cldr_file = os.path.join(cldr_dir, format['file'] % dict(locale=locale))
+                    tree = etree.parse(cldr_file) # TODO: error control
+                    try:
+                        original_value = tree.xpath(format['pattern'])
+                    except IndexError:
+                        output_file.write('# %s = \n' % (format['name']))
+                    else:
+                        value = format['conversion'](original_value, format['name'], locale, result)
+                        if value:
+                            output_file.write('%s = %s\n' % (format['name'], value.encode('utf8')))
+                            result[format['name']] = value
+                        else:
+                            output_file.write('# %s = \n' % (format['name']))
+                else:
+                    output_file.write('# %s = \n' % (format['name']))
+            output_file.close()
+
+            init_filename = os.path.join(django_locale_dir, locale, '__init__.py')
+            open(init_filename, 'a').close()
+
+class Command(LabelCommand):
+    option_list = LabelCommand.option_list + (
+        make_option('--locale', '-l', dest='locale',
+            help='The locale to process. Default is to process all.'),
+    ) + (
+        make_option('--overwite', '-o', action='store_true', dest='overwrite',
+            help='Wheter to overwrite format definitions of locales that already have one.'),
+    )
+    help = 'Creates format definition files for locales, importing data from the CLDR.'
+    args = '[cldrpath]'
+    label = 'CLDR path'
+    requires_model_validation = False
+    can_import_settings = False
+
+    def handle_label(self, cldrpath, **options):
+        locale = options.get('locale')
+        overwrite = options.get('overwrite')
+        import_cldr(cldrpath, locale, overwrite)
+
diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
index e36b8a1..04ad24d 100644
--- a/django/forms/extras/widgets.py
+++ b/django/forms/extras/widgets.py
@@ -8,6 +8,8 @@ import re
 from django.forms.widgets import Widget, Select
 from django.utils.dates import MONTHS
 from django.utils.safestring import mark_safe
+from django.utils.formats import getformat
+from django.conf import settings
 
 __all__ = ('SelectDateWidget',)
 
@@ -45,38 +47,27 @@ class SelectDateWidget(Widget):
                 if match:
                     year_val, month_val, day_val = [int(v) for v in match.groups()]
 
-        output = []
-
-        if 'id' in self.attrs:
-            id_ = self.attrs['id']
-        else:
-            id_ = 'id_%s' % name
-
-        month_choices = MONTHS.items()
-        if not (self.required and value):
-            month_choices.append(self.none_value)
-        month_choices.sort()
-        local_attrs = self.build_attrs(id=self.month_field % id_)
-        s = Select(choices=month_choices)
-        select_html = s.render(self.month_field % name, month_val, local_attrs)
-        output.append(select_html)
-
-        day_choices = [(i, i) for i in range(1, 32)]
-        if not (self.required and value):
-            day_choices.insert(0, self.none_value)
-        local_attrs['id'] = self.day_field % id_
-        s = Select(choices=day_choices)
-        select_html = s.render(self.day_field % name, day_val, local_attrs)
-        output.append(select_html)
-
-        year_choices = [(i, i) for i in self.years]
-        if not (self.required and value):
-            year_choices.insert(0, self.none_value)
-        local_attrs['id'] = self.year_field % id_
-        s = Select(choices=year_choices)
-        select_html = s.render(self.year_field % name, year_val, local_attrs)
-        output.append(select_html)
+        choices = [(i, i) for i in self.years]
+        year_html = self.create_select(name, self.year_field, value, year_val, choices)
+        choices = MONTHS.items()
+        month_html = self.create_select(name, self.month_field, value, month_val, choices)
+        choices = [(i, i) for i in range(1, 32)]
+        day_html = self.create_select(name, self.day_field, value, day_val,  choices)
 
+        format = getformat('DATE_FORMAT')
+        escaped = False
+        output = []
+        for char in format:
+            if escaped:
+                escaped = False
+            elif char == '\\':
+                escaped = True
+            elif char in 'Yy':
+                output.append(year_html)
+            elif char in 'bFMmNn':
+                output.append(month_html)
+            elif char in 'dj':
+                output.append(day_html)
         return mark_safe(u'\n'.join(output))
 
     def id_for_label(self, id_):
@@ -90,5 +81,27 @@ class SelectDateWidget(Widget):
         if y == m == d == "0":
             return None
         if y and m and d:
-            return '%s-%s-%s' % (y, m, d)
+            if settings.USE_FORMAT_I18N:
+                input_format = getformat('DATE_INPUT_FORMATS')[0]
+                try:
+                    date_value = datetime.date(int(y), int(m), int(d))
+                except ValueError:
+                    pass
+                else:
+                    return date_value.strftime(input_format)
+            else:
+                return '%s-%s-%s' % (y, m, d)
         return data.get(name, None)
+
+    def create_select(self, name, field, value, val, choices):
+        if 'id' in self.attrs:
+            id_ = self.attrs['id']
+        else:
+            id_ = 'id_%s' % name
+        if not (self.required and value):
+            choices.insert(0, self.none_value)
+        local_attrs = self.build_attrs(id=field % id_)
+        s = Select(choices=choices)
+        select_html = s.render(field % name, val, local_attrs)
+        return select_html
+
diff --git a/django/forms/fields.py b/django/forms/fields.py
index c0ee2f0..6009096 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -17,15 +17,14 @@ import django.core.exceptions
 import django.utils.copycompat as copy
 from django.utils.translation import ugettext_lazy as _
 from django.utils.encoding import smart_unicode, smart_str
+from django.utils.formats import getformat
 
 from util import ErrorList, ValidationError
 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
 
 __all__ = (
     'Field', 'CharField', 'IntegerField',
-    'DEFAULT_DATE_INPUT_FORMATS', 'DateField',
-    'DEFAULT_TIME_INPUT_FORMATS', 'TimeField',
-    'DEFAULT_DATETIME_INPUT_FORMATS', 'DateTimeField', 'TimeField',
+    'DateField', 'TimeField', 'DateTimeField', 'TimeField',
     'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
     'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
     'ComboField', 'MultiValueField', 'FloatField', 'DecimalField',
@@ -200,7 +199,9 @@ class FloatField(Field):
         if not self.required and value in EMPTY_VALUES:
             return None
         try:
-            value = float(value)
+            # We always accept dot as decimal separator
+            if isinstance(value, str) or isinstance(value, unicode):
+                value = float(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
         except (ValueError, TypeError):
             raise ValidationError(self.error_messages['invalid'])
         if self.max_value is not None and value > self.max_value:
@@ -236,7 +237,9 @@ class DecimalField(Field):
             return None
         value = smart_str(value).strip()
         try:
-            value = Decimal(value)
+            # We always accept dot as decimal separator
+            if isinstance(value, str) or isinstance(value, unicode):
+                value = Decimal(value.replace(getformat('DECIMAL_SEPARATOR'), '.'))
         except DecimalException:
             raise ValidationError(self.error_messages['invalid'])
 
@@ -264,14 +267,6 @@ class DecimalField(Field):
             raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places))
         return value
 
-DEFAULT_DATE_INPUT_FORMATS = (
-    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
-)
-
 class DateField(Field):
     widget = DateInput
     default_error_messages = {
@@ -280,7 +275,7 @@ class DateField(Field):
 
     def __init__(self, input_formats=None, *args, **kwargs):
         super(DateField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
+        self.input_formats = input_formats
 
     def clean(self, value):
         """
@@ -294,18 +289,13 @@ class DateField(Field):
             return value.date()
         if isinstance(value, datetime.date):
             return value
-        for format in self.input_formats:
+        for format in self.input_formats or getformat('DATE_INPUT_FORMATS'):
             try:
                 return datetime.date(*time.strptime(value, format)[:3])
             except ValueError:
                 continue
         raise ValidationError(self.error_messages['invalid'])
 
-DEFAULT_TIME_INPUT_FORMATS = (
-    '%H:%M:%S',     # '14:30:59'
-    '%H:%M',        # '14:30'
-)
-
 class TimeField(Field):
     widget = TimeInput
     default_error_messages = {
@@ -314,7 +304,7 @@ class TimeField(Field):
 
     def __init__(self, input_formats=None, *args, **kwargs):
         super(TimeField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats or DEFAULT_TIME_INPUT_FORMATS
+        self.input_formats = input_formats
 
     def clean(self, value):
         """
@@ -326,25 +316,13 @@ class TimeField(Field):
             return None
         if isinstance(value, datetime.time):
             return value
-        for format in self.input_formats:
+        for format in self.input_formats or getformat('TIME_INPUT_FORMATS'):
             try:
                 return datetime.time(*time.strptime(value, format)[3:6])
             except ValueError:
                 continue
         raise ValidationError(self.error_messages['invalid'])
 
-DEFAULT_DATETIME_INPUT_FORMATS = (
-    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
-    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
-    '%Y-%m-%d',              # '2006-10-25'
-    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
-    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
-    '%m/%d/%Y',              # '10/25/2006'
-    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
-    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
-    '%m/%d/%y',              # '10/25/06'
-)
-
 class DateTimeField(Field):
     widget = DateTimeInput
     default_error_messages = {
@@ -353,7 +331,7 @@ class DateTimeField(Field):
 
     def __init__(self, input_formats=None, *args, **kwargs):
         super(DateTimeField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
+        self.input_formats = input_formats
 
     def clean(self, value):
         """
@@ -373,7 +351,7 @@ class DateTimeField(Field):
             if len(value) != 2:
                 raise ValidationError(self.error_messages['invalid'])
             value = '%s %s' % tuple(value)
-        for format in self.input_formats:
+        for format in self.input_formats or getformat('DATETIME_INPUT_FORMATS'):
             try:
                 return datetime.datetime(*time.strptime(value, format)[:6])
             except ValueError:
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index d59e634..aabd1b0 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -10,6 +10,7 @@ from django.utils.html import escape, conditional_escape
 from django.utils.translation import ugettext
 from django.utils.encoding import StrAndUnicode, force_unicode
 from django.utils.safestring import mark_safe
+from django.utils.formats import localize
 from django.utils import datetime_safe
 from datetime import time
 from util import flatatt
@@ -208,7 +209,7 @@ class Input(Widget):
         final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
         if value != '':
             # Only add the 'value' attribute if a value is non-empty.
-            final_attrs['value'] = force_unicode(value)
+            final_attrs['value'] = force_unicode(localize(value, is_input=True))
         return mark_safe(u'<input%s />' % flatatt(final_attrs))
 
 class TextInput(Input):
diff --git a/django/template/__init__.py b/django/template/__init__.py
index 8764bfa..4c386be 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -60,6 +60,7 @@ from django.utils.text import smart_split, unescape_string_literal
 from django.utils.encoding import smart_unicode, force_unicode, smart_str
 from django.utils.translation import ugettext as _
 from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping
+from django.utils.formats import localize
 from django.utils.html import escape
 
 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
@@ -815,6 +816,7 @@ def _render_value_in_context(value, context):
     means escaping, if required, and conversion to a unicode object. If value
     is a string, it is expected to have already been translated.
     """
+    value = localize(value)
     value = force_unicode(value)
     if (context.autoescape and not isinstance(value, SafeData)) or isinstance(value, EscapeData):
         return escape(value)
diff --git a/django/template/debug.py b/django/template/debug.py
index c58c854..382fb75 100644
--- a/django/template/debug.py
+++ b/django/template/debug.py
@@ -2,6 +2,7 @@ from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, Templ
 from django.utils.encoding import force_unicode
 from django.utils.html import escape
 from django.utils.safestring import SafeData, EscapeData
+from django.utils.formats import localize
 
 class DebugLexer(Lexer):
     def __init__(self, template_string, origin):
@@ -84,7 +85,9 @@ class DebugNodeList(NodeList):
 class DebugVariableNode(VariableNode):
     def render(self, context):
         try:
-            output = force_unicode(self.filter_expression.resolve(context))
+            output = self.filter_expression.resolve(context)
+            output = localize(output)
+            output = force_unicode(output)
         except TemplateSyntaxError, e:
             if not hasattr(e, 'source'):
                 e.source = self.source
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index a8c2567..26b6b5e 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -18,6 +18,7 @@ from django.conf import settings
 from django.utils.translation import ugettext, ungettext
 from django.utils.encoding import force_unicode, iri_to_uri
 from django.utils.safestring import mark_safe, SafeData
+from django.utils.formats import date_format, number_format
 
 register = Library()
 
@@ -166,14 +167,14 @@ def floatformat(text, arg=-1):
         return input_val
 
     if not m and p < 0:
-        return mark_safe(u'%d' % (int(d)))
+        return mark_safe(number_format(u'%d' % (int(d)), 0))
 
     if p == 0:
         exp = Decimal(1)
     else:
         exp = Decimal('1.0') / (Decimal(10) ** abs(p))
     try:
-        return mark_safe(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)))
+        return mark_safe(number_format(u'%s' % str(d.quantize(exp, ROUND_HALF_UP)), abs(p)))
     except InvalidOperation:
         return input_val
 floatformat.is_safe = True
@@ -685,9 +686,12 @@ def date(value, arg=None):
     if arg is None:
         arg = settings.DATE_FORMAT
     try:
-        return format(value, arg)
+        return date_format(value, arg)
     except AttributeError:
-        return ''
+        try:
+            return format(value, arg)
+        except AttributeError:
+            return ''
 date.is_safe = False
 
 def time(value, arg=None):
@@ -698,9 +702,12 @@ def time(value, arg=None):
     if arg is None:
         arg = settings.TIME_FORMAT
     try:
-        return time_format(value, arg)
+        return date_format(value, arg)
     except AttributeError:
-        return ''
+        try:
+            return time_format(value, arg)
+        except AttributeError:
+            return ''
 time.is_safe = False
 
 def timesince(value, arg=None):
diff --git a/django/utils/formats.py b/django/utils/formats.py
new file mode 100644
index 0000000..51737b2
--- /dev/null
+++ b/django/utils/formats.py
@@ -0,0 +1,97 @@
+import decimal
+import datetime
+
+from django.conf import settings
+from django.utils.translation import get_language, to_locale, check_for_language
+from django.utils.importlib import import_module
+from django.utils import dateformat
+from django.utils import numberformat
+
+def get_format_modules():
+    """
+    Returns an iterator over the format modules found in the project and Django
+    """
+    modules = []
+    if not check_for_language(get_language()):
+        return modules
+    locale = to_locale(get_language())
+    if settings.FORMAT_MODULE_PATH:
+        format_locations = [settings.FORMAT_MODULE_PATH + '.%s']
+    else:
+        format_locations = []
+    format_locations.append('django.conf.locale.%s')
+    for location in format_locations:
+        for l in (locale, locale.split('_')[0]):
+            try:
+                mod = import_module('.formats', location % l)
+            except ImportError:
+                pass
+            else:
+                # Don't return duplicates
+                if mod not in modules:
+                    modules.append(mod)
+    return modules
+
+def getformat(format_type):
+    """
+    For a specific format type, returns the format for the
+    current language (locale) defaulting to the format on settings.
+    format_type is the name of the format, for example 'DATE_FORMAT'
+    """
+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
+        for module in get_format_modules():
+            try:
+                return getattr(module, format_type)
+            except AttributeError:
+                pass
+    return getattr(settings, format_type)
+
+def date_format(value, format=None):
+    """
+    Formats a datetime.date or datetime.datetime object using a
+    localizable format
+    """
+    return dateformat.format(value, getformat(format or 'DATE_FORMAT'))
+
+def number_format(value, decimal_pos=None):
+    """
+    Formats a numeric value using localization settings
+    """
+    return numberformat.format(
+        value,
+        getformat('DECIMAL_SEPARATOR'),
+        decimal_pos,
+        getformat('NUMBER_GROUPING'),
+        getformat('THOUSAND_SEPARATOR'),
+    )
+
+def localize(value, is_input=False):
+    """
+    Checks value, and if it has a localizable type (date,
+    number...) it returns the value as a string using
+    current locale format
+    """
+    if settings.USE_I18N and settings.USE_FORMAT_I18N:
+        if isinstance(value, decimal.Decimal):
+            return number_format(value)
+        elif isinstance(value, float):
+            return number_format(value)
+        elif isinstance(value, int):
+            return number_format(value)
+        elif isinstance(value, datetime.datetime):
+            if not is_input:
+                return date_format(value, 'DATETIME_FORMAT')
+            else:
+                return value.strftime(getformat('DATETIME_INPUT_FORMATS')[0])
+        elif isinstance(value, datetime.date):
+            if not is_input:
+                return date_format(value)
+            else:
+                return value.strftime(getformat('DATE_INPUT_FORMATS')[0])
+        elif isinstance(value, datetime.time):
+            if not is_input:
+                return date_format(value, 'TIME_FORMAT')
+            else:
+                return value.strftime(getformat('TIME_INPUT_FORMATS')[0])
+    return value
+
diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
new file mode 100644
index 0000000..78ecb2f
--- /dev/null
+++ b/django/utils/numberformat.py
@@ -0,0 +1,42 @@
+from django.conf import settings
+
+def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
+    """
+    Gets a number (as a number or string), and returns it as a string,
+    using formats definied as arguments:
+
+    * decimal_sep: Decimal separator symbol (for example ".")
+    * decimal_pos: Number of decimal positions
+    * grouping: Number of digits in every group limited by thousand separator
+    * thousand_sep: Thousand separator symbol (for example ",")
+
+    """
+    # sign
+    if float(number) < 0:
+        sign = '-'
+    else:
+        sign = ''
+    # decimal part
+    str_number = unicode(number)
+    if str_number[0] == '-':
+        str_number = str_number[1:]
+    if '.' in str_number:
+        int_part, dec_part = str_number.split('.')
+        if decimal_pos:
+            dec_part = dec_part[:decimal_pos]
+    else:
+        int_part, dec_part = str_number, ''
+    if decimal_pos:
+        dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
+    if dec_part: dec_part = decimal_sep + dec_part
+    # grouping
+    if settings.USE_THOUSAND_SEPARATOR and grouping:
+        int_part_gd = ''
+        for cnt, digit in enumerate(int_part[::-1]):
+            if cnt and not cnt % grouping:
+                int_part_gd += thousand_sep
+            int_part_gd += digit
+        int_part = int_part_gd[::-1]
+
+    return sign + int_part + dec_part
+
diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py
index 98c6de6..50f41a2 100644
--- a/django/utils/translation/trans_null.py
+++ b/django/utils/translation/trans_null.py
@@ -2,6 +2,7 @@
 # that don't actually do anything. This is purely for performance, so that
 # settings.USE_I18N = False can use this module rather than trans_real.py.
 
+import warnings
 from django.conf import settings
 from django.utils.encoding import force_unicode
 from django.utils.safestring import mark_safe, SafeData
@@ -18,10 +19,10 @@ activate = lambda x: None
 deactivate = deactivate_all = lambda: None
 get_language = lambda: settings.LANGUAGE_CODE
 get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
-get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT)
-get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
 check_for_language = lambda x: True
 
+# date formats shouldn't be used using gettext anymore. This
+# is kept for backward compatibility
 TECHNICAL_ID_MAP = {
     "DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
     "DATE_FORMAT": settings.DATE_FORMAT,
@@ -51,3 +52,21 @@ def to_locale(language):
 
 def get_language_from_request(request):
     return settings.LANGUAGE_CODE
+
+# get_date_formats and get_partial_date_formats aren't used anymore by Django
+# but are kept for backward compatibility.
+def get_date_formats():
+    warnings.warn(
+        '`django.utils.translation.get_date_formats` is deprecated. '
+        'Please update your code to use the new i18n aware formatting.',
+        PendingDeprecationWarning
+    )
+    return settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT
+
+def get_partial_date_formats():
+    warnings.warn(
+        '`django.utils.translation.get_partial_date_formats` is deprecated. '
+        'Please update your code to use the new i18n aware formatting.',
+        PendingDeprecationWarning
+    )
+    return settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 48ed7cc..8b7db0f 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -4,6 +4,7 @@ import locale
 import os
 import re
 import sys
+import warnings
 import gettext as gettext_module
 from cStringIO import StringIO
 
@@ -266,15 +267,16 @@ def do_translate(message, translation_function):
     translation object to use. If no current translation is activated, the
     message will be run through the default translation object.
     """
+    eol_message = message.replace('\r\n', '\n').replace('\r', '\n')
     global _default, _active
     t = _active.get(currentThread(), None)
     if t is not None:
-        result = getattr(t, translation_function)(message)
+        result = getattr(t, translation_function)(eol_message)
     else:
         if _default is None:
             from django.conf import settings
             _default = translation(settings.LANGUAGE_CODE)
-        result = getattr(_default, translation_function)(message)
+        result = getattr(_default, translation_function)(eol_message)
     if isinstance(message, SafeData):
         return mark_safe(result)
     return result
@@ -389,39 +391,6 @@ def get_language_from_request(request):
 
     return settings.LANGUAGE_CODE
 
-def get_date_formats():
-    """
-    Checks whether translation files provide a translation for some technical
-    message ID to store date and time formats. If it doesn't contain one, the
-    formats provided in the settings will be used.
-    """
-    from django.conf import settings
-    date_format = ugettext('DATE_FORMAT')
-    datetime_format = ugettext('DATETIME_FORMAT')
-    time_format = ugettext('TIME_FORMAT')
-    if date_format == 'DATE_FORMAT':
-        date_format = settings.DATE_FORMAT
-    if datetime_format == 'DATETIME_FORMAT':
-        datetime_format = settings.DATETIME_FORMAT
-    if time_format == 'TIME_FORMAT':
-        time_format = settings.TIME_FORMAT
-    return date_format, datetime_format, time_format
-
-def get_partial_date_formats():
-    """
-    Checks whether translation files provide a translation for some technical
-    message ID to store partial date formats. If it doesn't contain one, the
-    formats provided in the settings will be used.
-    """
-    from django.conf import settings
-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
-    month_day_format = ugettext('MONTH_DAY_FORMAT')
-    if year_month_format == 'YEAR_MONTH_FORMAT':
-        year_month_format = settings.YEAR_MONTH_FORMAT
-    if month_day_format == 'MONTH_DAY_FORMAT':
-        month_day_format = settings.MONTH_DAY_FORMAT
-    return year_month_format, month_day_format
-
 dot_re = re.compile(r'\S')
 def blankout(src, char):
     """
@@ -537,3 +506,52 @@ def parse_accept_lang_header(lang_string):
         result.append((lang, priority))
     result.sort(lambda x, y: -cmp(x[1], y[1]))
     return result
+
+# get_date_formats and get_partial_date_formats aren't used anymore by Django
+# and are kept for backward compatibility.
+# Note, it's also important to keep format names marked for translation.
+# For compatibility we still want to have formats on translation catalogs.
+# That makes template code like {{ my_date|date:_('DATE_FORMAT') }} still work
+def get_date_formats():
+    """
+    Checks whether translation files provide a translation for some technical
+    message ID to store date and time formats. If it doesn't contain one, the
+    formats provided in the settings will be used.
+    """
+    warnings.warn(
+        '`django.utils.translation.get_date_formats` is deprecated. '
+        'Please update your code to use the new i18n aware formatting.',
+        PendingDeprecationWarning
+    )
+    from django.conf import settings
+    date_format = ugettext('DATE_FORMAT')
+    datetime_format = ugettext('DATETIME_FORMAT')
+    time_format = ugettext('TIME_FORMAT')
+    if date_format == 'DATE_FORMAT':
+        date_format = settings.DATE_FORMAT
+    if datetime_format == 'DATETIME_FORMAT':
+        datetime_format = settings.DATETIME_FORMAT
+    if time_format == 'TIME_FORMAT':
+        time_format = settings.TIME_FORMAT
+    return date_format, datetime_format, time_format
+
+def get_partial_date_formats():
+    """
+    Checks whether translation files provide a translation for some technical
+    message ID to store partial date formats. If it doesn't contain one, the
+    formats provided in the settings will be used.
+    """
+    warnings.warn(
+        '`django.utils.translation.get_partial_date_formats` is deprecated. '
+        'Please update your code to use the new i18n aware formatting.',
+        PendingDeprecationWarning
+    )
+    from django.conf import settings
+    year_month_format = ugettext('YEAR_MONTH_FORMAT')
+    month_day_format = ugettext('MONTH_DAY_FORMAT')
+    if year_month_format == 'YEAR_MONTH_FORMAT':
+        year_month_format = settings.YEAR_MONTH_FORMAT
+    if month_day_format == 'MONTH_DAY_FORMAT':
+        month_day_format = settings.MONTH_DAY_FORMAT
+    return year_month_format, month_day_format
+
diff --git a/django/views/i18n.py b/django/views/i18n.py
index 0280698..ddd7520 100644
--- a/django/views/i18n.py
+++ b/django/views/i18n.py
@@ -1,10 +1,12 @@
+import os
+import gettext as gettext_module
+
 from django import http
 from django.conf import settings
 from django.utils import importlib
 from django.utils.translation import check_for_language, activate, to_locale, get_language
 from django.utils.text import javascript_quote
-import os
-import gettext as gettext_module
+from django.utils.formats import get_format_modules
 
 def set_language(request):
     """
@@ -32,6 +34,24 @@ def set_language(request):
                 response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code)
     return response
 
+def get_formats():
+    """
+    Returns an iterator over all formats in formats file
+    """
+    FORMAT_SETTINGS = ('DATE_FORMAT', 'DATETIME_FORMAT', 'TIME_FORMAT',
+        'YEAR_MONTH_FORMAT', 'MONTH_DAY_FORMAT', 'SHORT_DATE_FORMAT',
+        'SHORT_DATETIME_FORMAT', 'FIRST_DAY_OF_WEEK', 'DECIMAL_SEPARATOR',
+        'THOUSAND_SEPARATOR', 'NUMBER_GROUPING')
+
+    result = {}
+    for module in [settings] + get_format_modules():
+        for attr in FORMAT_SETTINGS:
+            try:
+                result[attr] = getattr(module, attr)
+            except AttributeError:
+                pass
+    return result
+
 NullSource = """
 /* gettext identity library */
 
@@ -185,10 +205,13 @@ def javascript_catalog(request, domain='djangojs', packages=None):
         else:
             raise TypeError, k
     csrc.sort()
-    for k,v in pdict.items():
+    for k, v in pdict.items():
         src.append("catalog['%s'] = [%s];\n" % (javascript_quote(k), ','.join(["''"]*(v+1))))
+    for k, v in get_formats().items():
+        src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v))))
     src.extend(csrc)
     src.append(LibFoot)
     src.append(InterPolate)
     src = ''.join(src)
     return http.HttpResponse(src, 'text/javascript')
+
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 8ff1509..1b57adf 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -288,12 +288,32 @@ DATE_FORMAT
 
 Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
 
-The default formatting to use for date fields on Django admin change-list
-pages -- and, possibly, by other parts of the system. See
-:ttag:`allowed date format strings <now>`.
+The default formatting to use for date fields in any part of the system.
+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
+be applied. See :ttag:`allowed date format strings <now>`.
+
+See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.
+
+.. setting:: DATE_INPUT_FORMATS
 
-See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``
-and ``MONTH_DAY_FORMAT``.
+DATE_INPUT_FORMATS
+------------------
+
+Default::
+
+    ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
+    '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
+    '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
+
+A tuple of formats that will be accepted when inputting data on a date
+field. Formats will be tried in order, using the first valid.
+Note that these format strings are specified in Python's datetime_ module
+syntax, that is different from the one used by Django for formatting dates
+to be displayed.
+
+See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
+
+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
 
 .. setting:: DATETIME_FORMAT
 
@@ -302,12 +322,32 @@ DATETIME_FORMAT
 
 Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
 
-The default formatting to use for datetime fields on Django admin change-list
-pages -- and, possibly, by other parts of the system. See
-:ttag:`allowed date format strings <now>`.
+The default formatting to use for datetime fields in any part of the system.
+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
+be applied. See :ttag:`allowed date format strings <now>`.
+
+See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
 
-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
+.. setting:: DATETIME_INPUT_FORMATS
+
+DATETIME_INPUT_FORMATS
+----------------------
+
+Default::
+
+    ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
+    '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
+    '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
+
+A tuple of formats that will be accepted when inputting data on a datetime
+field. Formats will be tried in order, using the first valid.
+Note that these format strings are specified in Python's datetime_ module
+syntax, that is different from the one used by Django for formatting dates
+to be displayed.
+
+See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
+
+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
 
 .. setting:: DEBUG
 
@@ -347,6 +387,14 @@ will be suppressed, and exceptions will propagate upwards.  This can
 be useful for some test setups, and should never be used on a live
 site.
 
+.. setting:: DECIMAL_SEPARATOR
+
+DECIMAL_SEPARATOR
+-----------------
+
+Default: ``'.'`` (Dot)
+
+Default decimal separator used when formatting decimal numbers.
 
 .. setting:: DEFAULT_CHARSET
 
@@ -596,6 +644,21 @@ system's standard umask.
 
 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
 
+.. setting:: FIRST_DAY_OF_WEEK
+
+FIRST_DAY_OF_WEEK
+-----------------
+
+Default: ``0`` (Sunday)
+
+Number representing the first day of the week. This is specially useful
+when displaying a calendar. This value is only used when not using
+format internationalization, or when a format cannot be found for the
+current locale.
+
+The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
+Monday and so on.
+
 .. setting:: FIXTURE_DIRS
 
 FIXTURE_DIRS
@@ -617,6 +680,34 @@ environment variable in any HTTP request. This setting can be used to override
 the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
 of the preferred value or not supplied at all.
 
+.. setting:: FORMAT_MODULE_PATH
+
+FORMAT_MODULE_PATH
+------------------
+
+Default: ``None``
+
+A full Python path to a Python package that contains format definitions for
+project locales. If not ``None``, Django will check for a ``formats.py``
+file, under the directory named as the current locale, and will use the
+formats defined on this file.
+
+For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and
+current language is ``en`` (English), Django will expect a directory tree
+like::
+
+    mysite/
+        formats/
+            __init__.py
+            en/
+                __init__.py
+                formats.py
+
+Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,
+``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,
+``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,
+``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
+
 .. setting:: IGNORABLE_404_ENDS
 
 IGNORABLE_404_ENDS
@@ -886,6 +977,21 @@ locales have different formats. For example, U.S. English would say
 See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
 
+.. setting:: NUMBER_GROUPING
+
+NUMBER_GROUPING
+----------------
+
+Default: ``0``
+
+Number of digits grouped together on the integer part of a number. Common use
+is to display a thousand separator. If this setting is ``0``, then, no grouping
+will be applied to the number. If this setting is greater than ``0`` then the
+setting ``THOUSAND_SEPARATOR`` will be used as the separator between those
+groups.
+
+See also ``THOUSAND_SEPARATOR``
+
 .. setting:: PREPEND_WWW
 
 PREPEND_WWW
@@ -1077,6 +1183,32 @@ Default: ``False``
 Whether to save the session data on every request. See
 :ref:`topics-http-sessions`.
 
+.. setting:: SHORT_DATE_FORMAT
+
+SHORT_DATE_FORMAT
+-----------------
+
+Default: ``m/d/Y`` (e.g. ``12/31/2003``)
+
+An available formatting that can be used for date fields on templates.
+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
+be applied. See :ttag:`allowed date format strings <now>`.
+
+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
+
+.. setting:: SHORT_DATETIME_FORMAT
+
+SHORT_DATETIME_FORMAT
+---------------------
+
+Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
+
+An available formatting that can be used for datetime fields on templates.
+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
+be applied. See :ttag:`allowed date format strings <now>`.
+
+See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
+
 .. setting:: SITE_ID
 
 SITE_ID
@@ -1231,6 +1363,18 @@ The name of the method to use for starting the test suite. See
 
 .. _Testing Django Applications: ../testing/
 
+.. setting:: THOUSAND_SEPARATOR
+
+THOUSAND_SEPARATOR
+------------------
+
+Default ``,`` (Comma)
+
+Default thousand separator used when formatting numbers. This setting is
+used only when ``NUMBER_GROUPPING`` is set.
+
+See also ``NUMBER_GROUPPING``, ``DECIMAL_SEPARATOR``
+
 .. setting:: TIME_FORMAT
 
 TIME_FORMAT
@@ -1238,12 +1382,28 @@ TIME_FORMAT
 
 Default: ``'P'`` (e.g. ``4 p.m.``)
 
-The default formatting to use for time fields on Django admin change-list
-pages -- and, possibly, by other parts of the system. See
-:ttag:`allowed date format strings <now>`.
+The default formatting to use for time fields in any part of the system.
+Note that if ``USE_FORMAT_I18N`` is set to ``True``, then locale format will
+be applied. See :ttag:`allowed date format strings <now>`.
 
-See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
-``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
+See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.
+
+.. setting:: TIME_INPUT_FORMATS
+
+TIME_INPUT_FORMATS
+------------------
+
+Default: ``('%H:%M:%S', '%H:%M')``
+
+A tuple of formats that will be accepted when inputting data on a time
+field. Formats will be tried in order, using the first valid.
+Note that these format strings are specified in Python's datetime_ module
+syntax, that is different from the one used by Django for formatting dates
+to be displayed.
+
+See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.
+
+.. _datetime: http://docs.python.org/library/datetime.html#strftime-behavior
 
 .. setting:: TIME_ZONE
 
@@ -1298,6 +1458,20 @@ A boolean that specifies whether to output the "Etag" header. This saves
 bandwidth but slows down performance. This is only used if ``CommonMiddleware``
 is installed (see :ref:`topics-http-middleware`).
 
+.. setting:: USE_FORMAT_I18N
+
+USE_FORMAT_I18N
+---------------
+
+Default ``False``
+
+A boolean that specifies if data will be localized by default or not. If this is
+set to ``True``, Django will display numbers and dates using the format of the
+current locale. It is required to set ``USE_I18N`` to ``True`` to allow data
+format localization.
+
+See also ``USE_I18N``
+
 .. setting:: USE_I18N
 
 USE_I18N
@@ -1310,6 +1484,22 @@ enabled. This provides an easy way to turn it off, for performance. If this is
 set to ``False``, Django will make some optimizations so as not to load the
 internationalization machinery.
 
+See also ``USE_FORMAT_I18N``
+
+.. setting:: USE_THOUSAND_SEPARATOR
+
+USE_THOUSAND_SEPARATOR
+----------------------
+
+Default ``False``
+
+A boolean that specifies wheter to display numbers using a thousand separator.
+If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``
+and ``NUMBER_GROUPING`` from current locale, to format the number.
+``USE_FORMAT_I18N`` must be set to ``True``, in order to format numbers.
+
+See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
+
 .. setting:: YEAR_MONTH_FORMAT
 
 YEAR_MONTH_FORMAT
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index bf2d9e8..29ccfef 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1047,7 +1047,11 @@ If ``value`` is ``"String with spaces"``, the output will be ``"Stringwithspaces
 date
 ~~~~
 
-Formats a date according to the given format (same as the `now`_ tag).
+Formats a date according to the given format.
+
+Given format can be one of the predefined ones ``DATE_FORMAT``, ``DATETIME_FORMAT``,
+``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a custom format, same as the
+`now`_ tag. Note that prefedined formats vary depending on the current locale.
 
 For example::
 
@@ -1062,7 +1066,7 @@ When used without a format string::
     {{ value|date }}
 
 ...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
-used.
+used, without applying any localization.
 
 .. templatefilter:: default
 
@@ -1610,7 +1614,11 @@ output will be ``"Joel is a slug"``.
 time
 ~~~~
 
-Formats a time according to the given format (same as the `now`_ tag).
+Formats a time according to the given format.
+
+Given format can be the predefined one ``TIME_FORMAT``, or a custom format,
+same as the `now`_ tag. Note that the predefined format is locale depending.
+
 The time filter will only accept parameters in the format string that relate
 to the time of day, not the date (for obvious reasons). If you need to
 format a date, use the `date`_ filter.
@@ -1627,7 +1635,7 @@ When used without a format string::
     {{ value|time }}
 
 ...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
-used.
+used, without aplying any localization.
 
 .. templatefilter:: timesince
 
diff --git a/docs/topics/i18n.txt b/docs/topics/i18n.txt
index c5f4ab6..0fd2663 100644
--- a/docs/topics/i18n.txt
+++ b/docs/topics/i18n.txt
@@ -4,20 +4,21 @@
 Internationalization
 ====================
 
-Django has full support for internationalization of text in code and templates.
-Here's how it works.
+Django has full support for internationalization, including translation
+capabilities of text in code and templates, and format localization for
+dates and numbers. Here's how it works.
 
 Overview
 ========
 
 The goal of internationalization is to allow a single Web application to offer
-its content and functionality in multiple languages.
+its content and functionality in multiple languages and locales.
 
-You, the Django developer, can accomplish this goal by adding a minimal amount
-of hooks to your Python code and templates. These hooks are called
-**translation strings**. They tell Django: "This text should be translated into
-the end user's language, if a translation for this text is available in that
-language."
+For text translation, you, the Django developer, can accomplish this goal by
+adding a minimal amount of hooks to your Python code and templates. These hooks
+are called **translation strings**. They tell Django: "This text should be
+translated into the end user's language, if a translation for this text is
+available in that language."
 
 Django takes care of using these hooks to translate Web apps, on the fly,
 according to users' language preferences.
@@ -29,6 +30,12 @@ Essentially, Django does two things:
     * It uses these hooks to translate Web apps for particular users according
       to their language preferences.
 
+For format localization, it's just necessary to set
+:setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings file. If
+:settings:`USE_FORMAT_I18N` is set to ``True``, then Django will display
+numbers and dates in the format of the current locale. That includes field
+representation on templates, and allowed input formats on the admin.
+
 If you don't need internationalization in your app
 ==================================================
 
@@ -1074,3 +1081,53 @@ have been found to not support this command. Do not attempt to use Django
 translation utilities with a ``gettext`` package if the command ``xgettext
 --version`` entered at a Windows command prompt causes a popup window saying
 "xgettext.exe has generated errors and will be closed by Windows".
+
+Format localization
+===================
+
+Django's formatting system is disabled by default. To enable it, it's necessay
+to set :setting:`USE_FORMAT_I18N = True <USE_FORMAT_I18N>` in your settings
+file.  Note that :setting:`USE_FORMAT_I18N` requires `USE_I18N` to be ``True``.
+
+When using Django's formatting system, dates and numbers on templates will be
+displayed using the format specified for the current locale. That means, two
+users accessing the same content, but in different language, will see date and
+number fields formatted in different ways, depending on the format for their
+current locale.
+
+Django will also use localized formats when parsing data in forms. That means
+Django uses different formats for different locales when guessing the format
+used by the user when inputting data on forms. Note that Django uses different
+formats for displaying data, and for parsing it.
+
+Creating custom format files
+----------------------------
+
+Django provides format definitions for many locales, but sometimes you could
+want to create your own ones, because a format files doesn't exist for your
+locale, or because you want to overwrite some of the values.
+
+To use custom formats, first thing to do, is to specify the path where you'll
+place format files. To do that, just set :setting:`FORMAT_MODULE_PATH` setting
+to the the path (in the format ``'foo.bar.baz``) where format files will
+exists.
+
+Files are not placed directly in this directory, but in a directory named as
+the locale. File must be named ``formats.py``.
+
+For customazing English formats, a structure like this would be needed::
+
+    mysite/
+        formats/
+            __init__.py
+            en/
+                __init__.py
+                formats.py
+
+where :file:`formats.py` contains custom format definitions. For example::
+
+    THOUSAND_SEPARATOR = ' '
+
+to use a space as thousand separator, instead of the default for English,
+comma.
+
diff --git a/tests/regressiontests/i18n/misc.py b/tests/regressiontests/i18n/misc.py
deleted file mode 100644
index f8f35ad..0000000
--- a/tests/regressiontests/i18n/misc.py
+++ /dev/null
@@ -1,114 +0,0 @@
-import sys
-
-tests = """
->>> from django.utils.translation.trans_real import parse_accept_lang_header
->>> p = parse_accept_lang_header
-
-#
-# Testing HTTP header parsing. First, we test that we can parse the values
-# according to the spec (and that we extract all the pieces in the right order).
-#
-
-Good headers.
->>> p('de')
-[('de', 1.0)]
->>> p('en-AU')
-[('en-AU', 1.0)]
->>> p('*;q=1.00')
-[('*', 1.0)]
->>> p('en-AU;q=0.123')
-[('en-AU', 0.123)]
->>> p('en-au;q=0.1')
-[('en-au', 0.10000000000000001)]
->>> p('en-au;q=1.0')
-[('en-au', 1.0)]
->>> p('da, en-gb;q=0.25, en;q=0.5')
-[('da', 1.0), ('en', 0.5), ('en-gb', 0.25)]
->>> p('en-au-xx')
-[('en-au-xx', 1.0)]
->>> p('de,en-au;q=0.75,en-us;q=0.5,en;q=0.25,es;q=0.125,fa;q=0.125')
-[('de', 1.0), ('en-au', 0.75), ('en-us', 0.5), ('en', 0.25), ('es', 0.125), ('fa', 0.125)]
->>> p('*')
-[('*', 1.0)]
->>> p('de;q=0.')
-[('de', 1.0)]
->>> p('')
-[]
-
-Bad headers; should always return [].
->>> p('en-gb;q=1.0000')
-[]
->>> p('en;q=0.1234')
-[]
->>> p('en;q=.2')
-[]
->>> p('abcdefghi-au')
-[]
->>> p('**')
-[]
->>> p('en,,gb')
-[]
->>> p('en-au;q=0.1.0')
-[]
->>> p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en')
-[]
->>> p('da, en-gb;q=0.8, en;q=0.7,#')
-[]
->>> p('de;q=2.0')
-[]
->>> p('de;q=0.a')
-[]
->>> p('')
-[]
-
-#
-# Now test that we parse a literal HTTP header correctly.
-#
-
->>> from django.utils.translation.trans_real import get_language_from_request
->>> g = get_language_from_request
->>> from django.http import HttpRequest
->>> r = HttpRequest
->>> r.COOKIES = {}
-
-These tests assumes the es, es_AR, pt and pt_BR translations exit in the Django
-source tree.
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
->>> g(r)
-'pt-br'
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
->>> g(r)
-'pt'
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
->>> g(r)
-'es'
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
->>> g(r)
-'es-ar'
-"""
-
-# Python 2.3 and 2.4 return slightly different results for completely bogus
-# locales, so we omit this test for that anything below 2.4. It's relatively
-# harmless in any cases (GIGO). This also means this won't be executed on
-# Jython currently, but life's like that sometimes. (On those platforms,
-# passing in a truly bogus locale will get you the default locale back.)
-if sys.version_info >= (2, 5):
-    tests += """
-This test assumes there won't be a Django translation to a US variation
-of the Spanish language, a safe assumption. When the user sets it
-as the preferred language, the main 'es' translation should be selected
-instead.
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
->>> g(r)
-'es'
-"""
-
-tests += """
-This tests the following scenario: there isn't a main language (zh)
-translation of Django but there is a translation to variation (zh_CN)
-the user sets zh-cn as the preferred language, it should be selected by
-Django without falling back nor ignoring it.
->>> r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
->>> g(r)
-'zh-cn'
-"""
diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
index 94e792c..2ab4ce6 100644
--- a/tests/regressiontests/i18n/tests.py
+++ b/tests/regressiontests/i18n/tests.py
@@ -1,72 +1,375 @@
-# coding: utf-8
-import misc
-
-regressions = ur"""
-Format string interpolation should work with *_lazy objects.
-
->>> from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
->>> s = ugettext_lazy('Add %(name)s')
->>> d = {'name': 'Ringo'}
->>> s % d
-u'Add Ringo'
->>> activate('de')
->>> s % d
-u'Ringo hinzuf\xfcgen'
->>> activate('pl')
->>> s % d
-u'Dodaj Ringo'
->>> deactivate()
-
-It should be possible to compare *_lazy objects.
-
->>> s1 = ugettext_lazy('Add %(name)s')
->>> s == s1
-True
->>> s2 = gettext_lazy('Add %(name)s')
->>> s3 = gettext_lazy('Add %(name)s')
->>> s2 == s3
-True
->>> s == s2
-True
->>> s4 = ugettext_lazy('Some other string')
->>> s == s4
-False
-
-unicode(string_concat(...)) should not raise a TypeError - #4796
-
->>> import django.utils.translation
->>> reload(django.utils.translation)
-<module 'django.utils.translation' from ...>
->>> unicode(django.utils.translation.string_concat("dja", "ngo"))
-u'django'
-
-Translating a string requiring no auto-escaping shouldn't change the "safe"
-status.
-
->>> from django.utils.safestring import mark_safe, SafeString
->>> s = mark_safe('Password')
->>> type(s)
-<class 'django.utils.safestring.SafeString'>
->>> activate('de')
->>> type(ugettext(s))
-<class 'django.utils.safestring.SafeUnicode'>
->>> deactivate()
-
->>> SafeString('a') + s
-'aPassword'
->>> s + SafeString('a')
-'Passworda'
->>> s + mark_safe('a')
-'Passworda'
->>> mark_safe('a') + s
-'aPassword'
->>> mark_safe('a') + mark_safe('s')
-'as'
->>> print s
-Password
-"""
-
-__test__ = {
-    'regressions': regressions,
-    'misc': misc.tests,
-}
+import sys
+from django.test import TestCase, client
+from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy
+
+class TranslationTests(TestCase):
+
+    def test_lazy_objects(self):
+        """
+        Format string interpolation should work with *_lazy objects.
+        """
+        s = ugettext_lazy('Add %(name)s')
+        d = {'name': 'Ringo'}
+        self.assertEqual(u'Add Ringo', s % d)
+        activate('de')
+        self.assertEqual(u'Ringo hinzuf\xfcgen', s % d)
+        activate('pl')
+        self.assertEqual(u'Dodaj Ringo', s % d)
+        deactivate()
+
+        # It should be possible to compare *_lazy objects.
+        s1 = ugettext_lazy('Add %(name)s')
+        self.assertEqual(True, s == s1)
+        s2 = gettext_lazy('Add %(name)s')
+        s3 = gettext_lazy('Add %(name)s')
+        self.assertEqual(True, s2 == s3)
+        self.assertEqual(True, s == s2)
+        s4 = ugettext_lazy('Some other string')
+        self.assertEqual(False, s == s4)
+
+    def test_string_concat(self):
+        """
+        unicode(string_concat(...)) should not raise a TypeError - #4796
+        """
+        import django.utils.translation
+        self.assertEqual(django.utils.translation, reload(django.utils.translation))
+        self.assertEqual(u'django', unicode(django.utils.translation.string_concat("dja", "ngo")))
+
+    def test_safe_status(self):
+        """
+        Translating a string requiring no auto-escaping shouldn't change the "safe" status.
+        """
+        from django.utils.safestring import mark_safe, SafeString, SafeUnicode
+        s = mark_safe('Password')
+        self.assertEqual(SafeString, type(s))
+        activate('de')
+        self.assertEqual(SafeUnicode, type(ugettext(s)))
+        deactivate()
+        self.assertEqual('aPassword', SafeString('a') + s)
+        self.assertEqual('Passworda', s + SafeString('a'))
+        self.assertEqual('Passworda', s + mark_safe('a'))
+        self.assertEqual('aPassword', mark_safe('a') + s)
+        self.assertEqual('as', mark_safe('a') + mark_safe('s'))
+        #self.assertEqual(Password, print s)
+
+    def test_maclines(self):
+        """
+        Translations on files with mac or dos end of lines will be converted
+        to unix eof in .po catalogs, and they have to match when retrieved
+        """
+        from django.utils.translation.trans_real import translation
+        ca_translation = translation('ca')
+        ca_translation._catalog[u'Mac\nEOF\n'] = u'Catalan Mac\nEOF\n'
+        ca_translation._catalog[u'Win\nEOF\n'] = u'Catalan Win\nEOF\n'
+        activate('ca')
+        self.assertEqual(u'Catalan Mac\nEOF\n', ugettext(u'Mac\rEOF\r'))
+        self.assertEqual(u'Catalan Win\nEOF\n', ugettext(u'Win\r\nEOF\r\n'))
+        deactivate()
+
+    def test_dates_and_numbers(self):
+        """
+        Localization of dates and numbers
+        """
+        import datetime
+        import decimal
+        from django.conf import settings
+        from django.utils.formats import getformat, date_format, number_format, localize
+        from django.utils.numberformat import format
+        from django import template, forms
+        from django.forms.extras import SelectDateWidget
+
+        old_use_i18n = settings.USE_I18N
+        old_use_format_i18n = settings.USE_FORMAT_I18N
+        old_use_thousand_separator = settings.USE_THOUSAND_SEPARATOR
+
+        n = decimal.Decimal('66666.666')
+        f = 99999.999
+        d = datetime.date(2009, 12, 31)
+        dt = datetime.datetime(2009, 12, 31, 20, 50)
+        ctxt = template.Context({'n': n, 'd': d, 'dt': dt, 'f': f})
+
+        # Locale independent
+
+        class I18nForm(forms.Form):
+            decimal_field = forms.DecimalField()
+            float_field = forms.FloatField()
+            date_field = forms.DateField()
+            datetime_field = forms.DateTimeField()
+            time_field = forms.TimeField()
+
+        class SelectDateForm(forms.Form):
+            date_field = forms.DateField(widget=SelectDateWidget)
+
+        settings.USE_FORMAT_I18N = True
+        settings.USE_THOUSAND_SEPARATOR = False
+        self.assertEqual(u'66666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
+        self.assertEqual(u'66666A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
+
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66,666.66', format(n, decimal_sep='.', decimal_pos=2, grouping=3, thousand_sep=','))
+        self.assertEqual(u'6B6B6B6B6A6', format(n, decimal_sep='A', decimal_pos=1, grouping=1, thousand_sep='B'))
+        self.assertEqual(u'-66666.6', format(-66666.666, decimal_sep='.', decimal_pos=1))
+        self.assertEqual(u'-66666.0', format(int('-66666'), decimal_sep='.', decimal_pos=1))
+
+        # Catalan locale with format i18n disabled translations will be used, but not formats
+
+        settings.USE_FORMAT_I18N = False
+        activate('ca')
+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
+        self.assertEqual(u'des. 31, 2009', date_format(d))
+        self.assertEqual(u'desembre 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
+        self.assertEqual('No localizable', localize('No localizable'))
+        self.assertEqual(decimal.Decimal('66666.666'), localize(n))
+        self.assertEqual(99999.999, localize(f))
+        self.assertEqual(datetime.date(2009, 12, 31), localize(d))
+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), localize(dt))
+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
+        self.assertEqual(u'2009-12-31', template.Template('{{ d }}').render(ctxt))
+        self.assertEqual(u'2009-12-31 20:50:00', template.Template('{{ dt }}').render(ctxt))
+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
+
+        form = I18nForm({
+            'decimal_field': u'66666,666',
+            'float_field': u'99999,999',
+            'date_field': u'31/12/2009',
+            'datetime_field': u'31/12/2009 20:50',
+            'time_field': u'20:50'
+        })
+        self.assertEqual(False, form.is_valid())
+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['float_field'])
+        self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
+        self.assertEqual([u'Introdu\xefu una data v\xe0lida.'], form.errors['date_field'])
+        self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
+
+        form2 = SelectDateForm({
+            'date_field_month': u'12',
+            'date_field_day': u'31',
+            'date_field_year': u'2009'
+        })
+        self.assertEqual(True, form2.is_valid())
+        self.assertEqual(datetime.date(2009, 12, 31), form2.cleaned_data['date_field'])
+        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)))
+        deactivate()
+
+        # Catalan locale
+
+        settings.USE_FORMAT_I18N = True
+        activate('ca')
+        self.assertEqual('j \de F \de Y', getformat('DATE_FORMAT'))
+        self.assertEqual(1, getformat('FIRST_DAY_OF_WEEK'))
+        self.assertEqual(',', getformat('DECIMAL_SEPARATOR'))
+        self.assertEqual(u'31 de desembre de 2009', date_format(d))
+        self.assertEqual(u'desembre del 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
+        self.assertEqual(u'31/12/2009 20:50', date_format(dt, 'SHORT_DATETIME_FORMAT'))
+        self.assertEqual('No localizable', localize('No localizable'))
+
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66.666,666', localize(n))
+        self.assertEqual(u'99.999,999', localize(f))
+
+        settings.USE_THOUSAND_SEPARATOR = False
+        self.assertEqual(u'66666,666', localize(n))
+        self.assertEqual(u'99999,999', localize(f))
+        self.assertEqual(u'31 de desembre de 2009', localize(d))
+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', localize(dt))
+
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
+        self.assertEqual(u'99.999,999', template.Template('{{ f }}').render(ctxt))
+
+        settings.USE_THOUSAND_SEPARATOR = False
+        self.assertEqual(u'66666,666', template.Template('{{ n }}').render(ctxt))
+        self.assertEqual(u'99999,999', template.Template('{{ f }}').render(ctxt))
+        self.assertEqual(u'31 de desembre de 2009', template.Template('{{ d }}').render(ctxt))
+        self.assertEqual(u'31 de desembre de 2009 a les 20:50', template.Template('{{ dt }}').render(ctxt))
+        self.assertEqual(u'66666,67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
+        self.assertEqual(u'100000,0', template.Template('{{ f|floatformat }}').render(ctxt))
+        self.assertEqual(u'31/12/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
+        self.assertEqual(u'31/12/2009 20:50', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
+
+        form3 = I18nForm({
+            'decimal_field': u'66666,666',
+            'float_field': u'99999,999',
+            'date_field': u'31/12/2009',
+            'datetime_field': u'31/12/2009 20:50',
+            'time_field': u'20:50'
+        })
+        self.assertEqual(True, form3.is_valid())
+        self.assertEqual(decimal.Decimal('66666.666'), form3.cleaned_data['decimal_field'])
+        self.assertEqual(99999.999, form3.cleaned_data['float_field'])
+        self.assertEqual(datetime.date(2009, 12, 31), form3.cleaned_data['date_field'])
+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form3.cleaned_data['datetime_field'])
+        self.assertEqual(datetime.time(20, 50), form3.cleaned_data['time_field'])
+
+        form4 = SelectDateForm({
+            'date_field_month': u'12',
+            'date_field_day': u'31',
+            'date_field_year': u'2009'
+        })
+        self.assertEqual(True, form4.is_valid())
+        self.assertEqual(datetime.date(2009, 12, 31), form4.cleaned_data['date_field'])
+        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)))
+        deactivate()
+
+        # English locale
+
+        settings.USE_FORMAT_I18N = True
+        activate('en')
+        self.assertEqual('N j, Y', getformat('DATE_FORMAT'))
+        self.assertEqual(0, getformat('FIRST_DAY_OF_WEEK'))
+        self.assertEqual('.', getformat('DECIMAL_SEPARATOR'))
+        self.assertEqual(u'Dec. 31, 2009', date_format(d))
+        self.assertEqual(u'December 2009', date_format(d, 'YEAR_MONTH_FORMAT'))
+        self.assertEqual(u'12/31/2009 8:50 p.m.', date_format(dt, 'SHORT_DATETIME_FORMAT'))
+        self.assertEqual('No localizable', localize('No localizable'))
+
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66,666.666', localize(n))
+        self.assertEqual(u'99,999.999', localize(f))
+
+        settings.USE_THOUSAND_SEPARATOR = False
+        self.assertEqual(u'66666.666', localize(n))
+        self.assertEqual(u'99999.999', localize(f))
+        self.assertEqual(u'Dec. 31, 2009', localize(d))
+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', localize(dt))
+
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66,666.666', template.Template('{{ n }}').render(ctxt))
+        self.assertEqual(u'99,999.999', template.Template('{{ f }}').render(ctxt))
+
+        settings.USE_THOUSAND_SEPARATOR = False
+        self.assertEqual(u'66666.666', template.Template('{{ n }}').render(ctxt))
+        self.assertEqual(u'99999.999', template.Template('{{ f }}').render(ctxt))
+        self.assertEqual(u'Dec. 31, 2009', template.Template('{{ d }}').render(ctxt))
+        self.assertEqual(u'Dec. 31, 2009, 8:50 p.m.', template.Template('{{ dt }}').render(ctxt))
+        self.assertEqual(u'66666.67', template.Template('{{ n|floatformat:2 }}').render(ctxt))
+        self.assertEqual(u'100000.0', template.Template('{{ f|floatformat }}').render(ctxt))
+        self.assertEqual(u'12/31/2009', template.Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(ctxt))
+        self.assertEqual(u'12/31/2009 8:50 p.m.', template.Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(ctxt))
+
+        form5 = I18nForm({
+            'decimal_field': u'66666.666',
+            'float_field': u'99999.999',
+            'date_field': u'12/31/2009',
+            'datetime_field': u'12/31/2009 20:50',
+            'time_field': u'20:50'
+        })
+        self.assertEqual(True, form5.is_valid())
+        self.assertEqual(decimal.Decimal('66666.666'), form5.cleaned_data['decimal_field'])
+        self.assertEqual(99999.999, form5.cleaned_data['float_field'])
+        self.assertEqual(datetime.date(2009, 12, 31), form5.cleaned_data['date_field'])
+        self.assertEqual(datetime.datetime(2009, 12, 31, 20, 50), form5.cleaned_data['datetime_field'])
+        self.assertEqual(datetime.time(20, 50), form5.cleaned_data['time_field'])
+
+        form6 = SelectDateForm({
+            'date_field_month': u'12',
+            'date_field_day': u'31',
+            'date_field_year': u'2009'
+        })
+        self.assertEqual(True, form6.is_valid())
+        self.assertEqual(datetime.date(2009, 12, 31), form6.cleaned_data['date_field'])
+        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)))
+        deactivate()
+
+        # Check if sublocales fall back to the main locale
+        activate('de-at')
+        settings.USE_THOUSAND_SEPARATOR = True
+        self.assertEqual(u'66.666,666', template.Template('{{ n }}').render(ctxt))
+        deactivate()
+
+        activate('es-ar')
+        self.assertEqual(u'31 de Diciembre de 2009', date_format(d))
+        deactivate()
+
+        # Restore defaults
+        settings.USE_I18N = old_use_i18n
+        settings.USE_FORMAT_I18N = old_use_format_i18n
+        settings.USE_THOUSAND_SEPARATOR = old_use_thousand_separator
+
+
+class MiscTests(TestCase):
+
+    def test_parse_spec_http_header(self):
+        """
+        Testing HTTP header parsing. First, we test that we can parse the
+        values according to the spec (and that we extract all the pieces in
+        the right order).
+        """
+        from django.utils.translation.trans_real import parse_accept_lang_header
+        p = parse_accept_lang_header
+        # Good headers.
+        self.assertEqual([('de', 1.0)], p('de'))
+        self.assertEqual([('en-AU', 1.0)], p('en-AU'))
+        self.assertEqual([('*', 1.0)], p('*;q=1.00'))
+        self.assertEqual([('en-AU', 0.123)], p('en-AU;q=0.123'))
+        self.assertEqual([('en-au', 0.10000000000000001)], p('en-au;q=0.1'))
+        self.assertEqual([('en-au', 1.0)], p('en-au;q=1.0'))
+        self.assertEqual([('da', 1.0), ('en', 0.5), ('en-gb', 0.25)], p('da, en-gb;q=0.25, en;q=0.5'))
+        self.assertEqual([('en-au-xx', 1.0)], p('en-au-xx'))
+        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'))
+        self.assertEqual([('*', 1.0)], p('*'))
+        self.assertEqual([('de', 1.0)], p('de;q=0.'))
+        self.assertEqual([], p(''))
+
+        # Bad headers; should always return [].
+        self.assertEqual([], p('en-gb;q=1.0000'))
+        self.assertEqual([], p('en;q=0.1234'))
+        self.assertEqual([], p('en;q=.2'))
+        self.assertEqual([], p('abcdefghi-au'))
+        self.assertEqual([], p('**'))
+        self.assertEqual([], p('en,,gb'))
+        self.assertEqual([], p('en-au;q=0.1.0'))
+        self.assertEqual([], p('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZ,en'))
+        self.assertEqual([], p('da, en-gb;q=0.8, en;q=0.7,#'))
+        self.assertEqual([], p('de;q=2.0'))
+        self.assertEqual([], p('de;q=0.a'))
+        self.assertEqual([], p(''))
+
+    def test_parse_literal_http_header(self):
+        """
+        Now test that we parse a literal HTTP header correctly.
+        """
+        from django.utils.translation.trans_real import get_language_from_request
+        g = get_language_from_request
+        from django.http import HttpRequest
+        r = HttpRequest
+        r.COOKIES = {}
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-br'}
+        self.assertEqual('pt-br', g(r))
+
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt'}
+        self.assertEqual('pt', g(r))
+
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es,de'}
+        self.assertEqual('es', g(r))
+
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
+        self.assertEqual('es-ar', g(r))
+
+        # Python 2.3 and 2.4 return slightly different results for completely
+        # bogus locales, so we omit this test for that anything below 2.4.
+        # It's relatively harmless in any cases (GIGO). This also means this
+        # won't be executed on Jython currently, but life's like that
+        # sometimes. (On those platforms, passing in a truly bogus locale
+        # will get you the default locale back.)
+        if sys.version_info >= (2, 5):
+            # This test assumes there won't be a Django translation to a US
+            # variation of the Spanish language, a safe assumption. When the
+            # user sets it as the preferred language, the main 'es'
+            # translation should be selected instead.
+            r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
+            self.assertEqual(g(r), 'es')
+
+        # This tests the following scenario: there isn't a main language (zh)
+        # translation of Django but there is a translation to variation (zh_CN)
+        # the user sets zh-cn as the preferred language, it should be selected
+        # by Django without falling back nor ignoring it.
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'zh-cn,de'}
+        self.assertEqual(g(r), 'zh-cn')
