Const.py files for different languages

every day i learn more about the background from HA.
and that means that every day i think about optimizing it to my wishes.

some time ago i started to make some template sensors to change the home/not_home in the frontend to on and offline.
with a lot off devices thats not really very nice.

today i found the const.py and there it is. home and not_home.

i browsed trough that file and found lots off part i see in the frontend. and they are all english which is obvious.
i thought about renaming it all, but there is a chance that that will be gone by the next update, unless i make a backup and implement the changes myself. thats not the way to go either.

so then i thought: how about a setting in the configuration yaml to choose the language?
then there could be const_en.py, const_de.py, const_nl.py …

I would very much like this as well. Might I ask how you solved the “online” / “offline” Issue? Because I had the same problem but not for all devices so I made template sensors for this.

Cheers

1 Like

changing home to online is quite simple.

open const.py in the homeassistent dir and change home to online in line 71.

dont forget that it effects youre automations to.
everywhere you have home in youre config, you have to change it.

1 Like

Aww okay that’s a no-go for me as I want some devices to actually state “home” / “not_home”. But thanks for sharing!

We already have had a conversation about Localisation a while back. For details check:

@PhyberApex i want some to say home too, but most off them not.
changing it there means that i have some templates left opposed to some without template.

@fabaff

if i read the part you link to, i see mostly people who like the idea.
untill balloob closed it and said that it should be discussed at the forum.

so lets discuss.

i’m not talking about really going indeep in the code and translating everything there.
1 thing that came up in the discussion is the local settings for temperature, time, etc. that part is already done.

i’m talking about a very small change. just making a const.py which looks at the config and then decides which const file it should take.

yeah after that maybe some minor parts are still english, but thats a very small part. and maybe in the future that small part could be put in the const files too.

i think that apart from the translations it would be very easy, and thats only because HA is set up so good.