in my custom integration i’m working on, i’d like to translate entity names.
in the language file (e.g. en.json) i define the translated name as "name": "{channel_display_name} Current Program", where channel_display_name is a translation placeholder.
I’m doing the same for state attribute names and config flow, and in english everything is working as expected.
But when changing the language to German, the entity name remains english.
Everything else (state attribute names + the config flow) is translated correctly…
On the sensor entity, i’m setting the following (see here):
I think I have found the answer to this but it has had me scratching my head, until a kind of light bulb understanding moment.
Anyway, it seems that whilst most translations work off the users language setting, entity name translations work off the server language setting (ie Settings → System → General).
So, when I didn’t get this, this made no sense at all. Until I changed the server language and readded the integration and I saw why. The entity_id is also translated!! As such, this cannot be different by user.
However, you can then get a very wierd situation in that the server (and therefore the entities) are all in 1 language and the rest of the screen in another (as you have seen!).
I am going to play with this more and maybe raise some sort of design discussion re this as it seems very confusing, and maybe it should change display name with the user language and the actual entity name with the server language.
EDIT: Or as a bare minimum, make this much clearer in the documentation.
I’ve tested with my integration, and it indeed works exactly as you’ve described. After changing the server language entity names are translated as expected.
+1 on making this more clear in the documentation
A bit off-topic, but do you know if it’s possible to add translation for entity attribution (the “Data Provided by xyz” text, as shown by the met.no integration)?