﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6693	Inconsistency in localized datetime formats between filters and utility functions	Petr Marhoun <petr.marhoun@…>	Marc Garcia	"I tried to understand handling of localized datetime formats in django. It seems filters (django.template.defaultfilters.date and django.template.defaultfilters.time) use settings - without any localization. And utility functions (django.utils.translation.trans_real.get_date_formats and django.utils.translation.trans_real.get_partial_date_formats) use localized values of strings ""DATE_FORMAT"", ""DATETIME_FORMAT"", ""TIME_FORMAT"", ""YEAR_MONTH_FORMAT"" and ""MONTH_DAY_FORMAT"" - settings is ignored (there are exceptions - if these strings are untranslated of if trans_null is used, utility functions behave as filters).

I don't think it is right. I would like to describe main use cases (with my opinions on them) and propose an solution.

= USE_I18N is False =

How it should be: Values from (global or local) settings should be used everywhere.

How it is: Without any problems.

= USE_I18N is True, only one language is used =

How it should be: As in the previous use case. And if the language is different from English, localized values should be used be default.

How it is: There are some problems - in templates (through filters) values are not localized be default; in admin (through utility functions) local settings is ignored.

Documentation says: ""DATE_FORMAT - The default formatting to use for date fields on Django admin change-list pages."" It is not true in this situation.

= USE_I18N is True, more languages are used =

How it should be: As in the previous use case. And it should be simple to translate datetime formats from local settings (these translations should be used everywhere).

How it is: There are some problems - both from the previous use case; translation of datetime formats from local settings is not simple.

= Possible solution =

 1. Mark DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT for translation in django.conf.global_settings.py.
 2. Translate these string to all languages.
 3. Use translated values of datetime formats from settings in filters.
 4. Deprecate get_date_formats and get_partial_date_formats and use ugettext/ugettext_lazy with arguments DATE_FORMAT and friends instead."		closed	Internationalization	dev		fixed	i18n-fixed	post@…	Fixed on a branch	1	0	0	0	0	0
