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

Add icon translations support #103294

Merged
merged 24 commits into from
Jan 19, 2024
Merged

Add icon translations support #103294

merged 24 commits into from
Jan 19, 2024

Conversation

frenck
Copy link
Member

@frenck frenck commented Nov 3, 2023

Proposed change

Add support for icon translations, as described in:

home-assistant/architecture#980

Frontend support: home-assistant/frontend#19406

Type of change

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

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@frenck frenck changed the title Add icons translations support Add icon translations support Nov 3, 2023
homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
homeassistant/components/binary_sensor/icons.json Outdated Show resolved Hide resolved
homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
script/hassfest/icons.py Outdated Show resolved Hide resolved
script/hassfest/icons.py Outdated Show resolved Hide resolved
Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentional to remove the icons from the demo text and time entities?

homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
@frenck frenck force-pushed the frenck-2023-1366 branch 2 times, most recently from a73b682 to 7997430 Compare November 13, 2023 13:46
@frenck
Copy link
Member Author

frenck commented Dec 12, 2023

Was it intentional to remove the icons from the demo text and time entities?

Yes, while moving this to icon translations, I removed those (as those are the default already).

../Frenck

homeassistant/components/demo/icons.json Outdated Show resolved Hide resolved
homeassistant/components/switch/icons.json Outdated Show resolved Hide resolved
homeassistant/components/switch/icons.json Outdated Show resolved Hide resolved
homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
homeassistant/helpers/icon.py Outdated Show resolved Hide resolved
tests/helpers/test_icon.py Outdated Show resolved Hide resolved
tests/components/frontend/test_init.py Outdated Show resolved Hide resolved
tests/components/frontend/test_init.py Outdated Show resolved Hide resolved
tests/components/frontend/test_init.py Outdated Show resolved Hide resolved
tests/components/frontend/test_init.py Outdated Show resolved Hide resolved
Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @frenck 👍

@frenck frenck marked this pull request as ready for review January 19, 2024 13:53
@frenck frenck requested a review from a team as a code owner January 19, 2024 13:53
@frenck frenck merged commit 0137202 into dev Jan 19, 2024
53 checks passed
@frenck frenck deleted the frenck-2023-1366 branch January 19, 2024 15:56
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2024
Comment on lines +65 to +66
if files_to_load and (
load_icons_job := hass.async_add_executor_job(_load_icons_files, files_to_load)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load_icons_job will never be falsy, as it will always return a Future. I think we can remove the second condition.


integrations: dict[str, Integration] = {}
domains = list({loaded.rpartition(".")[-1] for loaded in components})
ints_or_excs = await async_get_integrations(self._hass, domains)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should write out the words in the variable name. ints sounds like integers to me.

@home-assistant home-assistant unlocked this conversation Feb 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
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.

4 participants