🔹 template-entity-row - Put templates in an entities row

I guess that “_(key)” is resolved only for “evaluated” templates - as it was mentioned in the docs:

Consider this example:

  - type: custom:template-entity-row
    entity: sun.sun
    state: >-
      {% set VALUE = states(config.entity) -%}
      {%- set LOCALIZED_VALUE = '_(component.sun.state._.'+ VALUE + ')' -%}
      {{LOCALIZED_VALUE}}

изображение

Now try this:

    state: >-
      {% set VALUE = states(config.entity) -%}
      {%- set LOCALIZED_VALUE = '_(component.sun.state._.'+ VALUE + ')' -%}
      {{LOCALIZED_VALUE | upper }}

изображение

Seems that the “_(key)” is mainly not supposed to be used INSIDE templates.
Check this:

    state: >-
      _(component.sun.state._.{{states(config.entity)}})

which returns a localized string.
But you cannot process this string by “templating” (using “upper” etc).

Registered an issue.
Not sure if t is a bug or a FR.

1 Like