Skip to content

Conversation

@jbouwh
Copy link
Contributor

@jbouwh jbouwh commented Oct 22, 2025

Proposed change

To avoid URLs in service description strings, we want to be able to move those out of strings.json. This PR makes it possible to add description placeholders via the service registration.

Needs: home-assistant/frontend#27636

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

  • 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
Copy link

Hey there @Julius2342, @farmio, @marvin-w, mind taking a look at this pull request as it has been labeled with an integration (knx) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of knx can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign knx Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@farmio
Copy link
Contributor

farmio commented Oct 22, 2025

Hi 👋!
This yields

ERROR (MainThread) [frontend.js.modern.202510014] Failed to format translation for key 'component.knx.services.send.fields.type.description' in language 'en'. Error: The intl string context variable "sensor_value_types_url" was not provided to the string "If set, the payload will not be sent as raw bytes, but encoded as given DPT. KNX sensor types are valid values (see {sensor_value_types_url})."

when loading the frontend.

@jbouwh
Copy link
Contributor Author

jbouwh commented Oct 22, 2025

Oops, I'll do some more investigation.

@jbouwh jbouwh marked this pull request as draft October 22, 2025 20:16
@jbouwh
Copy link
Contributor Author

jbouwh commented Oct 22, 2025

It seems the API returns the correct translation strings, so I'm not sure what happens here yet.

@jbouwh
Copy link
Contributor Author

jbouwh commented Oct 22, 2025

Hi 👋! This yields

ERROR (MainThread) [frontend.js.modern.202510014] Failed to format translation for key 'component.knx.services.send.fields.type.description' in language 'en'. Error: The intl string context variable "sensor_value_types_url" was not provided to the string "If set, the payload will not be sent as raw bytes, but encoded as given DPT. KNX sensor types are valid values (see {sensor_value_types_url})."

when loading the frontend.

Try to clear you frontend cash. It should work after all (CTRL+F5) and restart your browser.

@emontnemery
Copy link
Contributor

I'm not sure the API changes are needed, this PR removes translations from the old service API #147120

I think that PR should be decided on first, because if it's accepted this PR is much simpler

@jbouwh jbouwh force-pushed the services-translation-placeholders branch from 69b409f to b0d611a Compare October 23, 2025 15:45
@emontnemery
Copy link
Contributor

The translation placeholders don't seem to be returned in the response to the WS command get_services

@emontnemery
Copy link
Contributor

Frontend also needs to be updated:

@jbouwh jbouwh changed the title Add description placeholders to service translation strings and implement this for the KNX integration Add description placeholders to service translation strings Oct 27, 2025
@jbouwh jbouwh marked this pull request as ready for review October 27, 2025 12:21
Copy link
Contributor

@emontnemery emontnemery 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 @jbouwh 👍

Can be merged when the frontend PR is approved.

@hembhagat99
Copy link
Contributor

@jbouwh, @emontnemery, I started looking into moving URLs out of strings.json and started with ntfy integration. I noticed that it registers its service using platform.async_register_entity_service, which is defined in entity_platform.py. Shouldn't we also update the contract in that file as well to accept the description_placeholders parameter?

Link to ntfy service registration code

@jbouwh jbouwh force-pushed the services-translation-placeholders branch from 6b9af13 to 8d28424 Compare November 4, 2025 19:26
@jbouwh
Copy link
Contributor Author

jbouwh commented Nov 4, 2025

@jbouwh, @emontnemery, I started looking into moving URLs out of strings.json and started with ntfy integration. I noticed that it registers its service using platform.async_register_entity_service, which is defined in entity_platform.py. Shouldn't we also update the contract in that file as well to accept the description_placeholders parameter?

Link to ntfy service registration code

You are right, that part was missed. Added the support and a test.

@joostlek
Copy link
Member

joostlek commented Nov 5, 2025

I think a good next step would be to make sure we have tooling like we have with issues and entity placeholders to check that we have the right placeholders filled

@bramkragten bramkragten merged commit 10299b2 into dev Nov 26, 2025
62 checks passed
@bramkragten bramkragten deleted the services-translation-placeholders branch November 26, 2025 08:54
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2025
@jbouwh
Copy link
Contributor Author

jbouwh commented Dec 8, 2025

I think a good next step would be to make sure we have tooling like we have with issues and entity placeholders to check that we have the right placeholders filled

#158225

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.

8 participants