Skip to content

Automatic language detection from Home Assistant global settings #264

@DanyLes

Description

@DanyLes

Thank you for this excellent media player card!

I'm reporting a bug regarding the localization of the card. Currently, automatic language detection does not work, and the card defaults to English even when the Home Assistant user profile is set to another language (like French).

After investigating the code, I found that the localize function (minified as h) only checks localStorage, which is often empty or not synced with Home Assistant's global settings.

Current broken logic:
const a = (localStorage.getItem("selectedLanguage") || "en")

Proposed fix to restore automatic localization:
const a = (localStorage.getItem("selectedLanguage") || document.querySelector("home-assistant").hass.language || "en")

By adding the document.querySelector("home-assistant").hass.language check, the card will finally respect the user's language choice in Home Assistant settings.

Thank you for this great project, hoping to see this fix in the next update!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions