Skip to content

Commit

Permalink
updates from feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts committed May 8, 2024
1 parent 5aa8cc9 commit 0386655
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/data/script_i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ const tryDescribeAction = <T extends ActionType>(
(config.service && isTemplate(config.service))
) {
return hass.localize(
`${actionTranslationBaseKey}.service.description.service_based_on_template`,
targets.length
? `${actionTranslationBaseKey}.service.description.service_based_on_template`
: `${actionTranslationBaseKey}.service.description.service_based_on_template_no_targets`,
{
hasTargets: targets.length ? "true" : "false",
targets: formatListWithAnds(hass.locale, targets),
}
);
Expand All @@ -210,23 +211,25 @@ const tryDescribeAction = <T extends ActionType>(

if (config.metadata) {
return hass.localize(
`${actionTranslationBaseKey}.service.description.service_name`,
targets.length
? `${actionTranslationBaseKey}.service.description.service_name`
: `${actionTranslationBaseKey}.service.description.service_name_no_targets`,
{
domain: domainToName(hass.localize, domain),
name: service || config.service,
hasTargets: targets.length ? "true" : "false",
targets: formatListWithAnds(hass.locale, targets),
}
);
}

return hass.localize(
`${actionTranslationBaseKey}.service.description.service_based_on_name`,
targets.length
? `${actionTranslationBaseKey}.service.description.service_based_on_name`
: `${actionTranslationBaseKey}.service.description.service_based_on_name_no_targets`,
{
name: service
? `${domainToName(hass.localize, domain)}: ${service}`
: config.service,
hasTargets: targets.length ? "true" : "false",
targets: formatListWithAnds(hass.locale, targets),
}
);
Expand Down
9 changes: 6 additions & 3 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3248,9 +3248,12 @@
"has_optional_response": "This service can return a response, if you want to use the response, enter the name of a variable the response will be saved in",
"has_response": "This service returns a response, enter the name of a variable the response will be saved in",
"description": {
"service_based_on_template": "Call a service based on a template{hasTargets, select, \n true { on {targets}} \n other {} \n }",
"service_based_on_name": "Call a service ''{name}''{hasTargets, select, \n true { on {targets}} \n other {} \n }",
"service_name": "{domain} ''{name}''{hasTargets, select, \n true { on {targets}} \n other {} \n }",
"service_based_on_template": "Call a service based on a template on {targets}",
"service_based_on_name": "Call a service ''{name}'' on {targets}",
"service_name": "{domain} ''{name}'' on {targets}",
"service_based_on_template_no_targets": "Call a service based on a template",
"service_based_on_name_no_targets": "Call a service ''{name}''",
"service_name_no_targets": "{domain} ''{name}''",
"service": "Call a service",
"target_template": "templated {name}",
"target_unknown_entity": "unknown entity",
Expand Down

0 comments on commit 0386655

Please sign in to comment.