home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.02k stars 2.75k forks source link

Cards are not translated #19455

Closed Gnarflord closed 9 months ago

Gnarflord commented 9 months ago

Checklist

Describe the issue you are experiencing

After setting my profile language to german most of the interface is translated but none of the cards are. In fact I can see the correct translation of entity states in the logbook but for example the history graph picks up the english default:

image

When editing the dashboard all interface elements are translated ("bearbeiten" instead of "edit") but again, the cards themselves are stuck in english: image

Describe the behavior you expected

I would have expected the entity state to be translated everywhere.

Steps to reproduce the issue

  1. Install latest home assistant
  2. Switch profile language from english to german

What version of Home Assistant Core has the issue?

core-2024.1.0

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chromium 121.0.6167.71, Firefox 121.0.1, Android App 2023.12.4-full

Which operating system are you using to run this browser?

Arch Linux 6.6.10, Android 14

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

karwosts commented 9 months ago

Have you changed the server language in Settings->System->General?

AFAIK state translations are handled by the server language, and frontend elements are by the frontend language, but I'm not 100% positive.

Gnarflord commented 9 months ago

image

Yes, the server language is set to german as well. I'm quite confused about this

karwosts commented 9 months ago

Hmm, ok did a little more looking and these are controlled by the frontend/profile language. If you look at any other entities, e.g. sun.sun, do any of them get translated?

image

Gnarflord commented 9 months ago

Thanks for looking into my issue :)

image

Nope, it's the same: The logbook has the translated entry while the graphical representation is stuck in english. I can also not find nothing related to that in the systemd log or the native HA log even with verbosity set to INFO.

My configuration.yaml also isn't that special:

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder:
  db_url: !secret recorder_mariadb_url

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1 # Add the IP address of the proxy server
#
#logger:
#  default: info
karwosts commented 9 months ago

What was your installation method? HAOS/core/docker ?

I feel like maybe for some reason the backend translation file is just missing on your system. The logbook entries ("Rose" / "Aufgegangen") are frontend translations, while actual entity states ("Above Horizon" / "Uber dem Horizont") is a backend translation.

Gnarflord commented 9 months ago

I have installed home assistant from the arch repository via pacman -Syu home-assistant. According to the PKGBUILD file in the repository this package is prepared like this:

I then ran this process manually myself to make sure nothing fishy happens with the script.translations command. The output looked fine to me:

[...]
Generating translations for zerproc
Generating translations for zeversolar
Generating translations for zha
Generating translations for zodiac
Generating translations for zone
Generating translations for zoneminder
Generating translations for zwave_js
Generating translations for zwave_me
Generating translations for facebox
🌎 Generated translation files for all integrations
* Getting build dependencies for wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
running egg_info
writing homeassistant.egg-info/PKG-INFO
writing dependency_links to homeassistant.egg-info/dependency_links.txt
writing entry points to homeassistant.egg-info/entry_points.txt
writing requirements to homeassistant.egg-info/requires.txt
writing top-level names to homeassistant.egg-info/top_level.txt
reading manifest file 'homeassistant.egg-info/SOURCES.txt'
[...]

BUT! It only seemed to generate the english translation:

> ls homeassistant/components/sun/translations/
en.json

> ls build/translations-download/
en.json

>

After poking around in the translation scripts I found out that additionally to translation.develops develop there needs to be a script.translations download or otherwise no data from lokalise is available at all. I joined the lokalise project, but as a contributer I don't have sufficient privileges to download the translation files of the project (403 Forbidden).

This is clearly an issue with the build process of the arch repo. Thank you for pushing me in the right direction and sorry that I opened this issue on the frontend project, I just had no idea how the localization process of HA worked. I'll take this issue downstream and figure out how to handle this best. Have a nice day! :)