As_timestamp and timestamp_custom local language

Hi,

I want to show the date of the next new/full moon. I have set upp a connection to Google Calendar and I am able to get the dates I want.

The calendar entity gives me a date in the format yyyy-mm-dd hh:mm:ss

As I only want the date and the day I have set up a value template as follows:

  new_moon:
    friendly_name: Nästa nymåne
    value_template: "{{ as_timestamp(states.calendar.next_new_moon.attributes.start_time) |  timestamp_custom('%-d %B') }}" 

This renders the date and day as I want but in English and not in my local language. How can I solve this?

Here’s something to read.

These parameters %-d %B generate results according to the operating system’s locale setting.

On the machine running Home Assistant, what is its default locale setting? I assume your local language is Swedish so is the machine’s locale set to Swedish? I think the language code is sv_SE.UTF-8.

1 Like

Correct - it is Swedish. I am not sure how to set the locale in Hassio.

Unfortunately, I am unfamiliar with how locale works with Hass.io. I believe you select the desired language during its installation. I don’t know if it can be changed afterwards. Was your Hass.io installed using Swedish as the chosen language?

Yes. I have been checking and I have not found an way to resolve it in Hassio. Will continue to look around. Worst case I will have to use the workaround proposed above.

Did you already solved the locale issue? I changed the locale on the machine but still can’t get it working

No - I still use the workaround. In most instances hassio returns Swedish responses for me. But in some cases like the one above I do not get an English response. No idea why.