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

Fix generated Lovelace translating domain names #5803

Merged
merged 4 commits into from
May 11, 2020

Conversation

balloob
Copy link
Member

@balloob balloob commented May 7, 2020

Breaking change

Proposed change

With the introduction of partial loaded translations, we now don't have access to the translations for domain names when generating Lovelace.

This is a problem because in Lovelace we group entities without an area in cards by their domain and use the translated title as the card title.

The fix is not easy, because when we load translations the updated hass object still has to propagate from the root element to where we are calling the function.

So this PR implements one proposal to fix this: return the updated hass from the hass.loadBackendTranslations function.

I don't like this fix.

Alternative that Bram thought of: allow localizing at the root via an event. That won't work in this case as we pass the localize function to generate Lovelace.

Alternative ideas:

  • Allow setting translation keys as card headers, so hass updating the card will update the translation. This can work but adds more logic to ha-card for something that is rarely used.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@balloob balloob requested a review from bramkragten May 7, 2020 21:25
@balloob balloob force-pushed the fix-lovelace-gen-card-translation branch from a136bc8 to e9af35c Compare May 7, 2020 21:46
@bramkragten
Copy link
Member

I think this is a little bit better, I can live with it now...

@bramkragten bramkragten marked this pull request as ready for review May 11, 2020 15:44
@bramkragten bramkragten force-pushed the fix-lovelace-gen-card-translation branch from be5b575 to 0baf295 Compare May 11, 2020 15:45
@balloob balloob merged commit 6d08233 into dev May 11, 2020
@balloob balloob deleted the fix-lovelace-gen-card-translation branch May 11, 2020 17:28
@bramkragten bramkragten mentioned this pull request May 12, 2020
@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants