Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions blog/2025-10-22-service-translation-placeholders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
author: Jan Bouwhuis
authorURL: https://github.com/jbouwh
authorImageURL: https://avatars.githubusercontent.com/u/7188918?s=96&v=4
title: Introducing description placeholders for service action translations
---
It is now possible to use translation placeholders for (custom) service actions.

The [service action example](/docs/core/integration-quality-scale/rules/action-setup?_highlight=hass.services.async_register#example-implementation) now shows how to supply the available description placeholders during the registration of the service action.

URLs that are part of the service transaction should be moved out of the service descriptions and translation strings using the description placeholders.
4 changes: 3 additions & 1 deletion docs/core/integration-quality-scale/rules/action-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ The example below is a snippet where the service action is registered in the `as
In this example, the service call requires a configuration entry id as parameter.
This is used to first fetch the configuration entry, and then check if it is loaded.
If the configuration entry does not exist or the configuration entry that we found is not loaded, we raise a relevant error which is shown to the user.
Optional description placeholders can be supplied.

`__init__py`:
```python {13-19} showLineNumbers
```python {13-20} showLineNumbers
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up my integration."""

Expand All @@ -43,6 +44,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async_get_schedule,
schema=SERVICE_GET_SCHEDULE_SCHEMA,
supports_response=SupportsResponse.ONLY,
description_placeholders={"example_url": "https://schedule.example.com"}
)
```

Expand Down