mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-16 05:46:30 +00:00
Document translation of entity names (#1707)
* Document translation of entity names * Adjust according to changes in the implementation * Update docs/internationalization/core.md Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update core.md --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
c560ad7fde
commit
c71b2177b9
@ -149,6 +149,23 @@ The translation strings for repairs issues are defined under the `issues` key. A
|
||||
|
||||
### Entities
|
||||
|
||||
#### Name of entities
|
||||
Integrations can provide translations for names of its entities. To do this, provide an `entity` object, that contains translations of the names and set the entity's `translation_key` property to a key under a domain in the `entity` object.
|
||||
If the entity's `translation_key` property is not `None` and the `entity` object provides a translated name, `EntityDescription.name` will be ignored.
|
||||
|
||||
The following example `strings.json` is for a `sensor` entity with its `translation_key` property set to `thermostat_mode`:
|
||||
```json
|
||||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"thermostat_mode": {
|
||||
"name": "Thermostat mode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### State of entities
|
||||
|
||||
Integrations can provide translations for states of its entities under other integrations like sensor if the base entity component does not provide translations, or if the translation provided by the base entity component do not match the integration's entity. To do this, provide an `entity` object, that contains translations for states and set the entity's `translation_key` property to a key under a domain in the `entity` object.
|
||||
|
Loading…
x
Reference in New Issue
Block a user