Extend usage of Data Entry Flow forms description_placeholders to field labels (#25115)

This commit is contained in:
Zhephyr 2025-04-23 11:46:15 +02:00 committed by GitHub
parent 8e778cfc32
commit 11b8f6210f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 9 deletions

View File

@ -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
);
}

View File

@ -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
);
}

View File

@ -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
);
}