2024.3: Finalize state_translated

This commit is contained in:
Franck Nijhof 2024-03-06 16:50:59 +01:00
parent 6a389d4be8
commit 71411ddda6
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -182,11 +182,11 @@ Remote UI feature.
## Translating states in your templates ## Translating states in your templates
Are you using templates to send notification in automations? If so, Are you using templates to send notifications in automations? If so,
[@PiotrMachowski] might just have added something you need this release! [@PiotrMachowski] might just have added something new you need!
He added a new template methods to translate entity states right in your A new template method, `state_translated`, to translate entity states directly
templates! Here is an example: in your language from your templates! Consider this template example:
{% raw %} {% raw %}
```yaml ```yaml
@ -196,8 +196,8 @@ templates! Here is an example:
``` ```
{% endraw %} {% endraw %}
The above two example, show the raw state of the entities. However, with the The above example shows the raw state of two entities. However, with the
new `state_translated` method, you can get the state in a human readable form: new `state_translated` method, you can get the state in a human-readable form:
{% raw %} {% raw %}
```yaml ```yaml
@ -208,8 +208,8 @@ new `state_translated` method, you can get the state in a human readable form:
{% endraw %} {% endraw %}
Even better, it uses the default language of your Home Assistant instance. So, Even better, it uses the default language of your Home Assistant instance. So,
if you are using Home Assistant in a different language, the translated state if you use Home Assistant in a different language, the translated state will
will be in that language. be in that language.
[@PiotrMachowski]: https://github.com/PiotrMachowski [@PiotrMachowski]: https://github.com/PiotrMachowski