Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template time_since is not translated #20859

Closed
4 tasks done
stefankoehne opened this issue May 23, 2024 · 1 comment
Closed
4 tasks done

Template time_since is not translated #20859

stefankoehne opened this issue May 23, 2024 · 1 comment

Comments

@stefankoehne
Copy link

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

I am using a conditional card with a markdown card in it, that shows the last change of an entity with "time_since".
The Problem is that it is not translating into my language (german) and is shown up in english.

Screenshot_8

I can't find any issues in localise, as it maybe is a hard coded thing?

Describe the behavior you expected

Translating the time like it does in the entity-popup
Screenshot_9

Steps to reproduce the issue

  1. Use another default-language in HA instead of english
  2. Create a boolean switch helper (or use existing one)
  3. Go to Developer tools > template and type in "{{ time_since(states.input_boolean.##ENTITY##.last_changed, 2) }}
  4. Tadaa, no translating. Time of last change shows up in english.

What version of Home Assistant Core has the issue?

2024.5.4

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Google Chrome 125.0.6422.76

Which operating system are you using to run this browser?

Windows 10 22H2

State of relevant entities

No response

Problem-relevant frontend configuration

- type: conditional
    conditions:
      - condition: state
        entity: input_boolean.dummy_switch
        state: 'on'
    card:
      type: markdown
      content: >-
        <ha-alert alert-type="info">Der Test läuft seit {{
        time_since(states.input_boolean.dummy_switch.last_changed, 2)
        }}</ha-alert>

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

@karwosts
Copy link
Contributor

Templates are never translated, unless you call a specific function to do so. Frontend sends the template string to core, and displays what core returns after rendering the template.

If time_since does not translate on locale that would need to be a new feature request for core.

@piitaya piitaya closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants