Skip to main content
Solved

Django Weekday language localization

  • November 5, 2024
  • 2 replies
  • 55 views

Forum|alt.badge.img+7

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 %}

 

 

2 replies

Forum|alt.badge.img+7
  • Klaviyo Employee
  • 182 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+7
  • Author
  • Problem Solver I
  • 34 replies
  • November 5, 2024

Thank you! :D