Troyer
Troyer

Reputation: 93

Django date field - translate only name of month

I am building a Django site, and is rendering date on my published articles like this: <p class="date">{{ article.publishing_date|date }}</p>.

I have only installed English as my language, but I would like the name of the month for my published articles, to be displayed in Spanish?

Is there a workaround for this, or must I install the Spanish as well?

Upvotes: 0

Views: 3026

Answers (1)

yask
yask

Reputation: 4288

In that particular template, format the date as:

{% load i18n %}

{% language 'es' %}
<p class="date">{{ article.publishing_date|date:'D, d N H:i:s e' }}</p>
{% endlanguage %}

Upvotes: 6

Related Questions