Skip to content

Commit c71b217

Browse files
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 <[email protected]> * Update core.md --------- Co-authored-by: Martin Hjelmare <[email protected]>
1 parent c560ad7 commit c71b217

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/internationalization/core.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ The translation strings for repairs issues are defined under the `issues` key. A
149149

150150
### Entities
151151

152+
#### Name of entities
153+
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.
154+
If the entity's `translation_key` property is not `None` and the `entity` object provides a translated name, `EntityDescription.name` will be ignored.
155+
156+
The following example `strings.json` is for a `sensor` entity with its `translation_key` property set to `thermostat_mode`:
157+
```json
158+
{
159+
"entity": {
160+
"sensor": {
161+
"thermostat_mode": {
162+
"name": "Thermostat mode"
163+
}
164+
}
165+
}
166+
}
167+
```
168+
152169
#### State of entities
153170

154171
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.

0 commit comments

Comments
 (0)