thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

Problems with the localization #56

Closed BoneheadFraggle closed 3 years ago

BoneheadFraggle commented 3 years ago

I still have problems with the localization that doesn't seem to work any more ("In evaluated templates the function () (underscore) will localize the to the current language. E.g. _(state.binarysensor.motion.off) will be replaced with Clear if your language is set to English.")

At first page load it seems fine:

Browser console: TEMPLATE-ENTITY-ROW 1.2.2 IS INSTALLED

No errors.

t-e-r 1

But when I press F5 or CTRL+F5 for reload these errors in browser console,

Browser console:

template-entity-row.js:244 Uncaught (in promise) TypeError: Cannot read property 'localize' of undefined
    at template-entity-row.js:244
    at RegExp.[Symbol.replace] (<anonymous>)
    at String.replace (<anonymous>)
    at bind_template.config.config (template-entity-row.js:244)
    at bind_template (template-entity-row.js:196)
    at HTMLElement.setConfig (template-entity-row.js:241)
    at s (chunk.f877794aa8421b754491.js:2416)
    at chunk.f877794aa8421b754491.js:2416
    at d (chunk.f877794aa8421b754491.js:2416)
    at c (chunk.f877794aa8421b754491.js:2416)

t-e-r 2

My code:

        - entity: binary_sensor.rorelsesensor_i_entre_tmpl
          active: '{{ states(config.entity) == "on" }}'
          condition: '{{ states(config.entity) == "on" }}'
          state: _(component.binary_sensor.state.motion.{{ states(config.entity) }})
          secondary: >-
            {{ as_timestamp(states[config.entity].last_changed) |
            timestamp_local }}
          type: custom:template-entity-row

Both with Edge Chromium and a brand new installed Chrome at first login. It may well be another cache issue, so if it is not reproducable, feel free to close it.

Reference to previous issue: https://github.com/thomasloven/lovelace-template-entity-row/issues/54

thomasloven commented 3 years ago

Try now

BoneheadFraggle commented 3 years ago

Confirmed OK. Thanks!