Hi Finn,

> In the Danish Django translation, DATE_FORMAT is "j. F Y".
> 
> In settings.py in my project I have:
> 
> LANGUAGE_CODE = 'da'
> USE_I18N = True
> USE_L10N = True
> 
> Now I have this in a template:
> 
> {{ object.published_on|date }}
> 
> I would now expect the date variable to be formatted like "10. juni
> 2010". Nevertheless, it is formatted like "June 10, 2010" (default/
> American formatting, I suppose).
> 
> How come?
> 
> If I specifically set the date format in settings.py like:
> 
> DATE_FORMAT = "j. F Y"
> 
> - I get: "10. June 2010" - which is still not correct!

As mentioned in the docs [1], the date filter won't apply any localization if 
not given a specific formatting string or the name of predefined format, such 
as "DATE_FORMAT".

So given your above example this is required to make the date filter query the 
locale system for the current locale's format called "DATE_FORMAT":

  {{ object.published_on|date:"DATE_FORMAT" }}


Hope that helps,

Jannis


1: http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#date


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to