Skip to main content
Solved

Django Weekday language localization

  • November 5, 2024
  • 2 replies
  • 42 views

Forum|alt.badge.img+6

Hi there :)

 

I want to be able to output the weekdays in different languages when using Django:

{% today '%Y-%m-%d' as today %} {{ today|days_later:3|format_date_string|date:'l' }}

Does anybody have a solution to this? 

 

Thanks!

Best answer by saulblum

You can localize the date strings! Here’s an example:

{% load i18n %}

{% language 'fr-fr' %}

{% today '%Y-%m-%d' as today %} {{ today|days_later:3|format_date_string|date:'l' }}

{% endlanguage %}

 

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Forum|alt.badge.img+7
  • Klaviyo Employee
  • 168 replies
  • Answer
  • November 5, 2024

You can localize the date strings! Here’s an example:

{% load i18n %}

{% language 'fr-fr' %}

{% today '%Y-%m-%d' as today %} {{ today|days_later:3|format_date_string|date:'l' }}

{% endlanguage %}

 

 


Forum|alt.badge.img+6
  • Author
  • Problem Solver I
  • 28 replies
  • November 5, 2024

Thank you! :D