mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 22:37:21 +00:00
Fix discovery name (#11445)
This commit is contained in:
parent
e4b9c08b45
commit
f59c30ac04
@ -104,18 +104,19 @@ export const localizeConfigFlowTitle = (
|
|||||||
localize: LocalizeFunc,
|
localize: LocalizeFunc,
|
||||||
flow: DataEntryFlowProgress
|
flow: DataEntryFlowProgress
|
||||||
) => {
|
) => {
|
||||||
const placeholders = flow.context.title_placeholders || {};
|
if (
|
||||||
const placeholderKeys = Object.keys(placeholders);
|
!flow.context.title_placeholders ||
|
||||||
if (placeholderKeys.length === 0) {
|
Object.keys(flow.context.title_placeholders).length === 0
|
||||||
|
) {
|
||||||
return domainToName(localize, flow.handler);
|
return domainToName(localize, flow.handler);
|
||||||
}
|
}
|
||||||
const args: string[] = [];
|
return (
|
||||||
placeholderKeys.forEach((key) => {
|
localize(
|
||||||
args.push(key);
|
`component.${flow.handler}.config.flow_title`,
|
||||||
args.push(placeholders[key]);
|
flow.context.title_placeholders
|
||||||
});
|
) ||
|
||||||
return localize(`component.${flow.handler}.config.flow_title`, ...args) ||
|
("name" in flow.context.title_placeholders
|
||||||
"name" in placeholders
|
? flow.context.title_placeholders.name
|
||||||
? placeholders.name
|
: domainToName(localize, flow.handler))
|
||||||
: domainToName(localize, flow.handler);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user