Newbie: How to localize weekday?

I am newbie - and the localisation is driving me crazy (2 days)
My Problem: I have a Markdown Card like this:

{{ states.sensor.todo_date_next.attributes | first | as_timestamp | timestamp_custom("%A, %d.%m.%Y") }}

So far i have the output: TODO Thursday, 07.04.2022

It works fine - but i want to localize the thursday, that is generated by timestamp_custom("%A

What i found was a hint:
{% set days = [“Montag”, “Dienstag”, “Mittwoch”, “Donnestag”, “Freitag”, “Samstag”, “Sonntag”] %}
but i tried every position with no effect.

Isn’t there a general “thing” where i can change this forever - to all weekdays?
And if no … :frowning: where do i put this set days, so that it will work only for that output …

I found many explantions on putting a so called template sensor in configuration.yaml - but that didn’t have an effect. I think because it’s not somehow binded to the output above?
It’s really driving me crazy :wink:

For your Markdown card you need something like the following:

{%- set days = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnestag", "Freitag", "Samstag"] %}
{%- set ts = states.sensor.todo_date_next.attributes | first | as_timestamp %}
{%- set today = days[ ts | timestamp_custom("%w") | int] %}
{{ ts | timestamp_custom(today~", %d.%m.%Y") }}

You are correct, the template sensors you mentioned do not alter the underlying processes so they have no effect when you call for a %A anywhere else.

1 Like

Thank you drew . You made my day.
It’s a pitty that there is no general way. In pyhton you only need to import locale and call locale.setlocale () … But however … i will not use that DayofWeek very often, so i can write it in the code. Thanks again and have a nice week.