Skip to content

Validate action translation placeholders#158225

Merged
epenet merged 6 commits into
devfrom
epenet-20251208-1018
Dec 8, 2025
Merged

Validate action translation placeholders#158225
epenet merged 6 commits into
devfrom
epenet-20251208-1018

Conversation

@epenet
Copy link
Copy Markdown
Contributor

@epenet epenet commented Dec 8, 2025

Proposed change

Ensure that description placeholders are valid in action translations.

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

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

Checklist

  • I understand the code I am submitting and can explain how it works.
  • 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 Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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.

To help with the load of incoming pull requests:

@home-assistant home-assistant Bot added cla-signed code-quality small-pr PRs with less than 30 lines. labels Dec 8, 2025
@epenet epenet marked this pull request as ready for review December 8, 2025 12:14
Copilot AI review requested due to automatic review settings December 8, 2025 12:14
@epenet epenet changed the title Add checks for action translations Validate action translation placeholders Dec 8, 2025
Copy link
Copy Markdown
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

Nice work, LGTM,
Thanks @epenet 👍

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds validation checks for action (service) translation placeholders during test execution. It ensures that when services are registered with description_placeholders, the corresponding translations contain valid placeholder references.

Key changes:

  • Added support for validating translation placeholders when service registration includes description_placeholders
  • Extended _validate_translation to handle wildcard validation using trailing "." notation for checking all subkeys
  • Patched ServiceRegistry.async_register to automatically validate service translation placeholders during tests

@epenet epenet merged commit 470f5a2 into dev Dec 8, 2025
71 of 72 checks passed
@epenet epenet deleted the epenet-20251208-1018 branch December 8, 2025 12:40
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed code-quality small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants