Skip to content

Conversation

@cr7pt0gr4ph7
Copy link
Contributor

@cr7pt0gr4ph7 cr7pt0gr4ph7 commented Sep 10, 2025

Proposed change

Allow adding translations for nested fields to support home-assistant/frontend#26997.
This PR is required because Supervisor filters the translation data based on SCHEMA_TRANSLATION_CONFIGURATION defined here, and removes unknown keys.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • 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
  • The code has been formatted using Ruff (ruff format supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints or add-on configuration are added/changed:

  • Documentation added/updated for developers.home-assistant.io
  • CLI updated (if necessary) Not necessary, translation data is simply passed through by the CLI.
  • Client library updated (if necessary) Not necessary, translation data is already exposed as translations: dict[str, any] by the client library.

Copy link
Contributor

@mdegat01 mdegat01 left a comment

Choose a reason for hiding this comment

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

Thanks to vol.Self this is really simple and clean, I like it. LGTM 👍

{
vol.Required(ATTR_NAME): str,
vol.Optional(ATTR_DESCRIPTON): vol.Maybe(str),
vol.Optional(ATTR_FIELDS): {str: vol.Self},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is quite nice. I honestly didn't realize vol.Self was an option for a making a recursive schema

Copy link
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@agners agners added the new-feature A new feature label Sep 16, 2025
@agners agners merged commit 857dae7 into home-assistant:main Sep 16, 2025
23 of 24 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants