From 11b8f6210f509c8ed704ce27bb13a6e8a66f16dc Mon Sep 17 00:00:00 2001 From: Zhephyr Date: Wed, 23 Apr 2025 11:46:15 +0200 Subject: [PATCH] Extend usage of Data Entry Flow forms description_placeholders to field labels (#25115) --- src/dialogs/config-flow/show-dialog-config-flow.ts | 9 ++++++--- src/dialogs/config-flow/show-dialog-options-flow.ts | 9 ++++++--- src/dialogs/config-flow/show-dialog-sub-config-flow.ts | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/dialogs/config-flow/show-dialog-config-flow.ts b/src/dialogs/config-flow/show-dialog-config-flow.ts index f94d1687d3..d4323b15f7 100644 --- a/src/dialogs/config-flow/show-dialog-config-flow.ts +++ b/src/dialogs/config-flow/show-dialog-config-flow.ts @@ -81,7 +81,8 @@ export const showConfigFlowDialog = ( renderShowFormStepFieldLabel(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${step.handler}.config.step.${step.step_id}.sections.${field.name}.name` + `component.${step.handler}.config.step.${step.step_id}.sections.${field.name}.name`, + step.description_placeholders ); } @@ -89,7 +90,8 @@ export const showConfigFlowDialog = ( return ( hass.localize( - `component.${step.handler}.config.step.${step.step_id}.${prefix}data.${field.name}` + `component.${step.handler}.config.step.${step.step_id}.${prefix}data.${field.name}`, + step.description_placeholders ) || field.name ); }, @@ -97,7 +99,8 @@ export const showConfigFlowDialog = ( renderShowFormStepFieldHelper(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${step.translation_domain || step.handler}.config.step.${step.step_id}.sections.${field.name}.description` + `component.${step.translation_domain || step.handler}.config.step.${step.step_id}.sections.${field.name}.description`, + step.description_placeholders ); } diff --git a/src/dialogs/config-flow/show-dialog-options-flow.ts b/src/dialogs/config-flow/show-dialog-options-flow.ts index 12919ff2e3..022704d408 100644 --- a/src/dialogs/config-flow/show-dialog-options-flow.ts +++ b/src/dialogs/config-flow/show-dialog-options-flow.ts @@ -96,7 +96,8 @@ export const showOptionsFlowDialog = ( renderShowFormStepFieldLabel(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${configEntry.domain}.options.step.${step.step_id}.sections.${field.name}.name` + `component.${configEntry.domain}.options.step.${step.step_id}.sections.${field.name}.name`, + step.description_placeholders ); } @@ -104,7 +105,8 @@ export const showOptionsFlowDialog = ( return ( hass.localize( - `component.${configEntry.domain}.options.step.${step.step_id}.${prefix}data.${field.name}` + `component.${configEntry.domain}.options.step.${step.step_id}.${prefix}data.${field.name}`, + step.description_placeholders ) || field.name ); }, @@ -112,7 +114,8 @@ export const showOptionsFlowDialog = ( renderShowFormStepFieldHelper(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${step.translation_domain || configEntry.domain}.options.step.${step.step_id}.sections.${field.name}.description` + `component.${step.translation_domain || configEntry.domain}.options.step.${step.step_id}.sections.${field.name}.description`, + step.description_placeholders ); } diff --git a/src/dialogs/config-flow/show-dialog-sub-config-flow.ts b/src/dialogs/config-flow/show-dialog-sub-config-flow.ts index bc886985b2..5c58671bea 100644 --- a/src/dialogs/config-flow/show-dialog-sub-config-flow.ts +++ b/src/dialogs/config-flow/show-dialog-sub-config-flow.ts @@ -87,7 +87,8 @@ export const showSubConfigFlowDialog = ( renderShowFormStepFieldLabel(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.sections.${field.name}.name` + `component.${configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.sections.${field.name}.name`, + step.description_placeholders ); } @@ -95,7 +96,8 @@ export const showSubConfigFlowDialog = ( return ( hass.localize( - `component.${configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.${prefix}data.${field.name}` + `component.${configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.${prefix}data.${field.name}`, + step.description_placeholders ) || field.name ); }, @@ -103,7 +105,8 @@ export const showSubConfigFlowDialog = ( renderShowFormStepFieldHelper(hass, step, field, options) { if (field.type === "expandable") { return hass.localize( - `component.${step.translation_domain || configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.sections.${field.name}.description` + `component.${step.translation_domain || configEntry.domain}.config_subentries.${flowType}.step.${step.step_id}.sections.${field.name}.description`, + step.description_placeholders ); }