@@ -624,10 +625,10 @@ class HassioAddonInfo extends LitElement {
${this.supervisor.localize(
"addon.dashboard.not_available_version",
- "core_version_installed",
- this.supervisor.core.version,
- "core_version_needed",
- addonStoreInfo!.homeassistant
+ {
+ core_version_installed: this.supervisor.core.version,
+ core_version_needed: addonStoreInfo!.homeassistant,
+ }
)}
`
@@ -800,12 +801,11 @@ class HassioAddonInfo extends LitElement {
id === "stage"
? this.supervisor.localize(
`addon.dashboard.capability.${id}.description`,
- "icon_stable",
- `
`,
- "icon_experimental",
- `
`,
- "icon_deprecated",
- `
`
+ {
+ icon_stable: `
`,
+ icon_experimental: `
`,
+ icon_deprecated: `
`,
+ }
)
: this.supervisor.localize(
`addon.dashboard.capability.${id}.description`
@@ -867,11 +867,9 @@ class HassioAddonInfo extends LitElement {
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.failed_to_save",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.failed_to_save", {
+ error: extractApiErrorMessage(err),
+ });
}
}
@@ -889,11 +887,9 @@ class HassioAddonInfo extends LitElement {
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.failed_to_save",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.failed_to_save", {
+ error: extractApiErrorMessage(err),
+ });
}
}
@@ -911,11 +907,9 @@ class HassioAddonInfo extends LitElement {
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.failed_to_save",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.failed_to_save", {
+ error: extractApiErrorMessage(err),
+ });
}
}
@@ -933,11 +927,9 @@ class HassioAddonInfo extends LitElement {
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.failed_to_save",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.failed_to_save", {
+ error: extractApiErrorMessage(err),
+ });
}
}
@@ -955,11 +947,9 @@ class HassioAddonInfo extends LitElement {
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.failed_to_save",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.failed_to_save", {
+ error: extractApiErrorMessage(err),
+ });
}
}
diff --git a/hassio/src/addon-view/log/hassio-addon-logs.ts b/hassio/src/addon-view/log/hassio-addon-logs.ts
index 2dc96453ff..c2cd53f962 100644
--- a/hassio/src/addon-view/log/hassio-addon-logs.ts
+++ b/hassio/src/addon-view/log/hassio-addon-logs.ts
@@ -72,11 +72,9 @@ class HassioAddonLogs extends LitElement {
try {
this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "addon.logs.get_logs",
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("addon.logs.get_logs", {
+ error: extractApiErrorMessage(err),
+ });
}
}
diff --git a/hassio/src/dashboard/hassio-update.ts b/hassio/src/dashboard/hassio-update.ts
index 80a0f14ebb..b331dc7609 100644
--- a/hassio/src/dashboard/hassio-update.ts
+++ b/hassio/src/dashboard/hassio-update.ts
@@ -46,11 +46,9 @@ export class HassioUpdate extends LitElement {
return html`
- ${this.supervisor.localize(
- "common.update_available",
- "count",
- updatesAvailable
- )}
+ ${this.supervisor.localize("common.update_available", {
+ count: updatesAvailable,
+ })}
🎉
diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts
index f3a77f8b40..182efad690 100644
--- a/hassio/src/dialogs/network/dialog-hassio-network.ts
+++ b/hassio/src/dialogs/network/dialog-hassio-network.ts
@@ -145,8 +145,7 @@ export class DialogHassioNetwork
? html`
${this.supervisor.localize(
"dialog.network.connected_to",
- "ssid",
- this._interface?.wifi?.ssid
+ { ssid: this._interface?.wifi?.ssid }
)}
`
: ""}
diff --git a/hassio/src/hassio-my-redirect.ts b/hassio/src/hassio-my-redirect.ts
index 71bc873eb6..0640d4820f 100644
--- a/hassio/src/hassio-my-redirect.ts
+++ b/hassio/src/hassio-my-redirect.ts
@@ -76,17 +76,15 @@ class HassioMyRedirect extends LitElement {
const redirect = REDIRECTS[path];
if (!redirect) {
- this._error = this.supervisor.localize(
- "my.not_supported",
- "link",
- html`
${this.supervisor.localize("my.faq_link")}
- `
- );
+ `,
+ });
return;
}
diff --git a/hassio/src/system/hassio-core-info.ts b/hassio/src/system/hassio-core-info.ts
index 7754728757..f005700b17 100644
--- a/hassio/src/system/hassio-core-info.ts
+++ b/hassio/src/system/hassio-core-info.ts
@@ -96,13 +96,11 @@ class HassioCoreInfo extends LitElement {
slot="primaryAction"
class="warning"
@click=${this._coreRestart}
- .title=${this.supervisor.localize(
- "common.restart_name",
- "name",
- "Core"
- )}
+ .title=${this.supervisor.localize("common.restart_name", {
+ name: "Core",
+ })}
>
- ${this.supervisor.localize("common.restart_name", "name", "Core")}
+ ${this.supervisor.localize("common.restart_name", { name: "Core" })}
@@ -122,16 +120,12 @@ class HassioCoreInfo extends LitElement {
button.progress = true;
const confirmed = await showConfirmationDialog(this, {
- title: this.supervisor.localize(
- "confirm.restart.title",
- "name",
- "Home Assistant Core"
- ),
- text: this.supervisor.localize(
- "confirm.restart.text",
- "name",
- "Home Assistant Core"
- ),
+ title: this.supervisor.localize("confirm.restart.title", {
+ name: "Home Assistant Core",
+ }),
+ text: this.supervisor.localize("confirm.restart.text", {
+ name: "Home Assistant Core",
+ }),
confirmText: this.supervisor.localize("common.restart"),
dismissText: this.supervisor.localize("common.cancel"),
});
@@ -146,11 +140,9 @@ class HassioCoreInfo extends LitElement {
} catch (err: any) {
if (this.hass.connection.connected) {
showAlertDialog(this, {
- title: this.supervisor.localize(
- "common.failed_to_restart_name",
- "name",
- "Home AssistantCore"
- ),
+ title: this.supervisor.localize("common.failed_to_restart_name", {
+ name: "Home Assistant Core",
+ }),
text: extractApiErrorMessage(err),
});
}
diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts
index 661757e0c1..69ef2a64f3 100644
--- a/hassio/src/system/hassio-supervisor-info.ts
+++ b/hassio/src/system/hassio-supervisor-info.ts
@@ -200,17 +200,13 @@ class HassioSupervisorInfo extends LitElement {
- ${this.supervisor.localize(
- "common.restart_name",
- "name",
- "Supervisor"
- )}
+ ${this.supervisor.localize("common.restart_name", {
+ name: "Supervisor",
+ })}
@@ -292,16 +288,12 @@ class HassioSupervisorInfo extends LitElement {
button.progress = true;
const confirmed = await showConfirmationDialog(this, {
- title: this.supervisor.localize(
- "confirm.restart.title",
- "name",
- "Supervisor"
- ),
- text: this.supervisor.localize(
- "confirm.restart.text",
- "name",
- "Supervisor"
- ),
+ title: this.supervisor.localize("confirm.restart.title", {
+ name: "Supervisor",
+ }),
+ text: this.supervisor.localize("confirm.restart.text", {
+ name: "Supervisor",
+ }),
confirmText: this.supervisor.localize("common.restart"),
dismissText: this.supervisor.localize("common.cancel"),
});
@@ -315,11 +307,9 @@ class HassioSupervisorInfo extends LitElement {
await restartSupervisor(this.hass);
} catch (err: any) {
showAlertDialog(this, {
- title: this.supervisor.localize(
- "common.failed_to_restart_name",
- "name",
- "Supervisor"
- ),
+ title: this.supervisor.localize("common.failed_to_restart_name", {
+ name: "Supervisor",
+ }),
text: extractApiErrorMessage(err),
});
} finally {
@@ -334,8 +324,7 @@ class HassioSupervisorInfo extends LitElement {
),
text: this.supervisor.localize(
"system.supervisor.share_diagonstics_description",
- "line_break",
- html`
`
+ { line_break: html`
` }
),
});
}
diff --git a/hassio/src/system/hassio-supervisor-log.ts b/hassio/src/system/hassio-supervisor-log.ts
index fec60d6d03..a2e1d1d75e 100644
--- a/hassio/src/system/hassio-supervisor-log.ts
+++ b/hassio/src/system/hassio-supervisor-log.ts
@@ -124,13 +124,10 @@ class HassioSupervisorLog extends LitElement {
this._selectedLogProvider
);
} catch (err: any) {
- this._error = this.supervisor.localize(
- "system.log.get_logs",
- "provider",
- this._selectedLogProvider,
- "error",
- extractApiErrorMessage(err)
- );
+ this._error = this.supervisor.localize("system.log.get_logs", {
+ provider: this._selectedLogProvider,
+ error: extractApiErrorMessage(err),
+ });
}
}
diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts
index 35cbbaf813..17802aca3b 100644
--- a/src/auth/ha-auth-flow.ts
+++ b/src/auth/ha-auth-flow.ts
@@ -181,11 +181,9 @@ export class HaAuthFlow extends LitElement {
case "error":
return html`
- ${this.localize(
- "ui.panel.page-authorize.form.error",
- "error",
- this._errorMessage
- )}
+ ${this.localize("ui.panel.page-authorize.form.error", {
+ error: this._errorMessage,
+ })}
diff --git a/src/common/translations/localize.ts b/src/common/translations/localize.ts
index c53d2862c8..ac1d759efd 100644
--- a/src/common/translations/localize.ts
+++ b/src/common/translations/localize.ts
@@ -1,4 +1,5 @@
import IntlMessageFormat from "intl-messageformat";
+import type { HTMLTemplateResult } from "lit";
import { polyfillLocaleData } from "../../resources/locale-data-polyfill";
import { Resources, TranslationDict } from "../../types";
@@ -40,9 +41,13 @@ export type FlattenObjectKeys<
: `${Key}`
: never;
+// Later, don't return string when HTML is passed, and don't allow undefined
export type LocalizeFunc = (
key: Keys,
- ...args: any[]
+ values?: Record<
+ string,
+ string | number | HTMLTemplateResult | null | undefined
+ >
) => string;
interface FormatType {
@@ -124,6 +129,7 @@ export const computeLocalize = async (
argObject = args[0];
} else {
for (let i = 0; i < args.length; i += 2) {
+ // @ts-expect-error in some places the old format (key, value, key, value) is used
argObject[args[i]] = args[i + 1];
}
}
diff --git a/src/components/ha-button-related-filter-menu.ts b/src/components/ha-button-related-filter-menu.ts
index c83bdcdd6c..0225f77cab 100644
--- a/src/components/ha-button-related-filter-menu.ts
+++ b/src/components/ha-button-related-filter-menu.ts
@@ -126,8 +126,11 @@ export class HaRelatedFilterButtonMenu extends LitElement {
}
const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_entity",
- "entity_name",
- computeStateName((ev.currentTarget as any).comboBox.selectedItem)
+ {
+ entity_name: computeStateName(
+ (ev.currentTarget as any).comboBox.selectedItem
+ ),
+ }
);
const items = await findRelated(this.hass, "entity", entityId);
fireEvent(this, "related-changed", {
@@ -146,11 +149,12 @@ export class HaRelatedFilterButtonMenu extends LitElement {
}
const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_device",
- "device_name",
- computeDeviceName(
- (ev.currentTarget as any).comboBox.selectedItem,
- this.hass
- )
+ {
+ device_name: computeDeviceName(
+ (ev.currentTarget as any).comboBox.selectedItem,
+ this.hass
+ ),
+ }
);
const items = await findRelated(this.hass, "device", deviceId);
@@ -170,8 +174,7 @@ export class HaRelatedFilterButtonMenu extends LitElement {
}
const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_area",
- "area_name",
- (ev.currentTarget as any).comboBox.selectedItem.name
+ { area_name: (ev.currentTarget as any).comboBox.selectedItem.name }
);
const items = await findRelated(this.hass, "area", areaId);
fireEvent(this, "related-changed", {
diff --git a/src/components/ha-file-upload.ts b/src/components/ha-file-upload.ts
index 2b741a1c19..29e8b07ed4 100644
--- a/src/components/ha-file-upload.ts
+++ b/src/components/ha-file-upload.ts
@@ -64,7 +64,7 @@ export class HaFileUpload extends LitElement {
>${this.value
? this.hass?.localize(
"ui.components.file-upload.uploading_name",
- { name: this.value }
+ { name: this.value.toString() }
)
: this.hass?.localize(
"ui.components.file-upload.uploading"
diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts
index fabad8b828..de52e29bf8 100644
--- a/src/components/media-player/ha-media-player-browse.ts
+++ b/src/components/media-player/ha-media-player-browse.ts
@@ -800,10 +800,8 @@ export class HaMediaPlayerBrowse extends LitElement {
${this.hass.localize("ui.components.media-browser.no_media_folder")}
- ${this.hass.localize(
- "ui.components.media-browser.setup_local_help",
- "documentation",
- html`${this.hass.localize(
"ui.components.media-browser.documentation"
)}`
- )}
+ >`,
+ })}
${this.hass.localize("ui.components.media-browser.local_media_files")}
diff --git a/src/data/application_credential.ts b/src/data/application_credential.ts
index 65f9d25a7d..4b4cebdac9 100644
--- a/src/data/application_credential.ts
+++ b/src/data/application_credential.ts
@@ -1,7 +1,7 @@
import { HomeAssistant } from "../types";
export interface ApplicationCredentialsDomainConfig {
- description_placeholders: string;
+ description_placeholders: Record;
}
export interface ApplicationCredentialsConfig {
diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts
index cfc22189fb..6cb4ec8070 100644
--- a/src/data/automation_i18n.ts
+++ b/src/data/automation_i18n.ts
@@ -374,7 +374,7 @@ const tryDescribeTrigger = (
trigger.event === "sunset"
? `${triggerTranslationBaseKey}.sun.description.sets`
: `${triggerTranslationBaseKey}.sun.description.rises`,
- { hasDuration: duration !== "", duration: duration }
+ { hasDuration: duration !== "" ? "true" : "false", duration: duration }
);
}
@@ -604,7 +604,7 @@ const tryDescribeTrigger = (
return hass.localize(
`${triggerTranslationBaseKey}.template.description.full`,
- { hasDuration: duration !== "", duration: duration }
+ { hasDuration: duration !== "" ? "true" : "false", duration: duration }
);
}
@@ -959,8 +959,8 @@ const tryDescribeCondition = (
`${conditionsTranslationBaseKey}.time.description.full`,
{
hasTime: hasTime,
- hasTimeAndDay: (after || before) && validWeekdays,
- hasDay: validWeekdays,
+ hasTimeAndDay: (after || before) && validWeekdays ? "true" : "false",
+ hasDay: validWeekdays ? "true" : "false",
time_before: before,
time_after: after,
day: formatListWithOrs(hass.locale, localizedDays),
diff --git a/src/data/device_automation.ts b/src/data/device_automation.ts
index 5dc8e28792..b32355e833 100644
--- a/src/data/device_automation.ts
+++ b/src/data/device_automation.ts
@@ -201,14 +201,14 @@ export const localizeDeviceAutomationAction = (
): string =>
hass.localize(
`component.${action.domain}.device_automation.action_type.${action.type}`,
- "entity_name",
- getEntityName(hass, entityRegistry, action.entity_id),
- "subtype",
- action.subtype
- ? hass.localize(
- `component.${action.domain}.device_automation.action_subtype.${action.subtype}`
- ) || action.subtype
- : ""
+ {
+ entity_name: getEntityName(hass, entityRegistry, action.entity_id),
+ subtype: action.subtype
+ ? hass.localize(
+ `component.${action.domain}.device_automation.action_subtype.${action.subtype}`
+ ) || action.subtype
+ : "",
+ }
) || (action.subtype ? `"${action.subtype}" ${action.type}` : action.type!);
export const localizeDeviceAutomationCondition = (
@@ -218,14 +218,14 @@ export const localizeDeviceAutomationCondition = (
): string =>
hass.localize(
`component.${condition.domain}.device_automation.condition_type.${condition.type}`,
- "entity_name",
- getEntityName(hass, entityRegistry, condition.entity_id),
- "subtype",
- condition.subtype
- ? hass.localize(
- `component.${condition.domain}.device_automation.condition_subtype.${condition.subtype}`
- ) || condition.subtype
- : ""
+ {
+ entity_name: getEntityName(hass, entityRegistry, condition.entity_id),
+ subtype: condition.subtype
+ ? hass.localize(
+ `component.${condition.domain}.device_automation.condition_subtype.${condition.subtype}`
+ ) || condition.subtype
+ : "",
+ }
) ||
(condition.subtype
? `"${condition.subtype}" ${condition.type}`
@@ -238,14 +238,14 @@ export const localizeDeviceAutomationTrigger = (
): string =>
hass.localize(
`component.${trigger.domain}.device_automation.trigger_type.${trigger.type}`,
- "entity_name",
- getEntityName(hass, entityRegistry, trigger.entity_id),
- "subtype",
- trigger.subtype
- ? hass.localize(
- `component.${trigger.domain}.device_automation.trigger_subtype.${trigger.subtype}`
- ) || trigger.subtype
- : ""
+ {
+ entity_name: getEntityName(hass, entityRegistry, trigger.entity_id),
+ subtype: trigger.subtype
+ ? hass.localize(
+ `component.${trigger.domain}.device_automation.trigger_subtype.${trigger.subtype}`
+ ) || trigger.subtype
+ : "",
+ }
) ||
(trigger.subtype ? `"${trigger.subtype}" ${trigger.type}` : trigger.type!);
diff --git a/src/data/device_registry.ts b/src/data/device_registry.ts
index 6995e4b924..488ee1f365 100644
--- a/src/data/device_registry.ts
+++ b/src/data/device_registry.ts
@@ -65,13 +65,11 @@ export const computeDeviceName = (
device.name_by_user ||
device.name ||
(entities && fallbackDeviceName(hass, entities)) ||
- hass.localize(
- "ui.panel.config.devices.unnamed_device",
- "type",
- hass.localize(
+ hass.localize("ui.panel.config.devices.unnamed_device", {
+ type: hass.localize(
`ui.panel.config.devices.type.${device.entry_type || "device"}`
- )
- );
+ ),
+ });
export const devicesInArea = (devices: DeviceRegistryEntry[], areaId: string) =>
devices.filter((device) => device.area_id === areaId);
diff --git a/src/data/logbook.ts b/src/data/logbook.ts
index 8534d548ce..703ca6969d 100644
--- a/src/data/logbook.ts
+++ b/src/data/logbook.ts
@@ -194,7 +194,7 @@ export const localizeStateMessage = (
if (state === "home") {
return localize(`${LOGBOOK_LOCALIZE_PATH}.was_at_home`);
}
- return localize(`${LOGBOOK_LOCALIZE_PATH}.was_at_state`, "state", state);
+ return localize(`${LOGBOOK_LOCALIZE_PATH}.was_at_state`, { state });
case "sun":
return state === "above_horizon"
@@ -382,11 +382,9 @@ export const localizeStateMessage = (
return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unavailable`);
}
- return hass.localize(
- `${LOGBOOK_LOCALIZE_PATH}.changed_to_state`,
- "state",
- stateObj ? hass.formatEntityState(stateObj, state) : state
- );
+ return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.changed_to_state`, {
+ state: stateObj ? hass.formatEntityState(stateObj, state) : state,
+ });
};
export const filterLogbookCompatibleEntities: HaEntityPickerEntityFilterFunc = (
diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts
index 301f585709..1ba30198bd 100644
--- a/src/data/script_i18n.ts
+++ b/src/data/script_i18n.ts
@@ -259,9 +259,15 @@ const tryDescribeAction = (
return hass.localize(
`${actionTranslationBaseKey}.play_media.description.full`,
{
- hasMedia: config.metadata.title || config.data.media_content_id,
- media: config.metadata.title || config.data.media_content_id,
- hasMediaPlayer: mediaStateObj ? true : entityId !== undefined,
+ hasMedia:
+ config.metadata.title || config.data.media_content_id
+ ? "true"
+ : "false",
+ media:
+ (config.metadata.title as string | undefined) ||
+ config.data.media_content_id,
+ hasMediaPlayer:
+ mediaStateObj || entityId !== undefined ? "true" : "false",
mediaPlayer: mediaStateObj ? computeStateName(mediaStateObj) : entityId,
}
);
@@ -317,7 +323,7 @@ const tryDescribeAction = (
if (actionType === "stop") {
const config = action as StopAction;
return hass.localize(`${actionTranslationBaseKey}.stop.description.full`, {
- hasReason: config.stop !== undefined,
+ hasReason: config.stop !== undefined ? "true" : "false",
reason: config.stop,
});
}
diff --git a/src/data/update.ts b/src/data/update.ts
index ba9df3a555..cf13f58daf 100644
--- a/src/data/update.ts
+++ b/src/data/update.ts
@@ -177,10 +177,10 @@ export const computeUpdateStateDisplay = (
if (updateIsInstalling(stateObj)) {
const supportsProgress =
supportsFeature(stateObj, UPDATE_SUPPORT_PROGRESS) &&
- typeof typeof attributes.in_progress === "number";
+ typeof attributes.in_progress === "number";
if (supportsProgress) {
return hass.localize("ui.card.update.installing_with_progress", {
- progress: attributes.in_progress,
+ progress: attributes.in_progress as number,
});
}
return hass.localize("ui.card.update.installing");
diff --git a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts
index afd1c6f159..7ed96ec061 100644
--- a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts
+++ b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts
@@ -56,9 +56,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
@closed=${this.closeDialog}
.heading=${this.hass.localize(
"ui.dialogs.config_entry_system_options.title",
- "integration",
- this.hass.localize(`component.${this._params.entry.domain}.title`) ||
- this._params.entry.domain
+ {
+ integration:
+ this.hass.localize(
+ `component.${this._params.entry.domain}.title`
+ ) || this._params.entry.domain,
+ }
)}
>
${this._error ? html` ${this._error}
` : ""}
@@ -71,10 +74,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
${this.hass.localize(
"ui.dialogs.config_entry_system_options.enable_new_entities_description",
- "integration",
- this.hass.localize(
- `component.${this._params.entry.domain}.title`
- ) || this._params.entry.domain
+ {
+ integration:
+ this.hass.localize(
+ `component.${this._params.entry.domain}.title`
+ ) || this._params.entry.domain,
+ }
)}
`}
.dir=${computeRTLDirection(this.hass)}
@@ -96,10 +101,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
${this.hass.localize(
"ui.dialogs.config_entry_system_options.enable_polling_description",
- "integration",
- this.hass.localize(
- `component.${this._params.entry.domain}.title`
- ) || this._params.entry.domain
+ {
+ integration:
+ this.hass.localize(
+ `component.${this._params.entry.domain}.title`
+ ) || this._params.entry.domain,
+ }
)}
`}
.dir=${computeRTLDirection(this.hass)}
diff --git a/src/dialogs/config-flow/show-dialog-config-flow.ts b/src/dialogs/config-flow/show-dialog-config-flow.ts
index 23c37f1797..9ccc581840 100644
--- a/src/dialogs/config-flow/show-dialog-config-flow.ts
+++ b/src/dialogs/config-flow/show-dialog-config-flow.ts
@@ -174,8 +174,7 @@ export const showConfigFlowDialog = (
${hass.localize(
"ui.panel.config.integrations.config_flow.created_config",
- "name",
- step.title
+ { name: step.title }
)}
`;
diff --git a/src/dialogs/config-flow/step-flow-create-entry.ts b/src/dialogs/config-flow/step-flow-create-entry.ts
index 1ceb034b7a..f7e15836d7 100644
--- a/src/dialogs/config-flow/step-flow-create-entry.ts
+++ b/src/dialogs/config-flow/step-flow-create-entry.ts
@@ -98,8 +98,7 @@ class StepFlowCreateEntry extends LitElement {
showAlertDialog(this, {
text: this.hass.localize(
"ui.panel.config.integrations.config_flow.error_saving_area",
- "error",
- err.message
+ { error: err.message }
),
});
picker.value = null;
diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts
index 306b0f40be..ae69269952 100644
--- a/src/dialogs/notifications/configurator-notification-item.ts
+++ b/src/dialogs/notifications/configurator-notification-item.ts
@@ -25,11 +25,9 @@ export class HuiConfiguratorNotificationItem extends LitElement {
- ${this.hass.localize(
- "ui.notification_drawer.click_to_configure",
- "entity",
- this.notification.attributes.friendly_name
- )}
+ ${this.hass.localize("ui.notification_drawer.click_to_configure", {
+ entity: this.notification.attributes.friendly_name,
+ })}
diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts
index b849d4fe02..e17a32f7ad 100644
--- a/src/dialogs/quick-bar/ha-quick-bar.ts
+++ b/src/dialogs/quick-bar/ha-quick-bar.ts
@@ -523,11 +523,9 @@ export class QuickBar extends LitElement {
const commands = reloadableDomains.map((domain) => ({
primaryText:
this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) ||
- this.hass.localize(
- "ui.dialogs.quick-bar.commands.reload.reload",
- "domain",
- domainToName(localize, domain)
- ),
+ this.hass.localize("ui.dialogs.quick-bar.commands.reload.reload", {
+ domain: domainToName(localize, domain),
+ }),
action: () => this.hass.callService(domain, "reload"),
iconPath: mdiReload,
categoryText: this.hass.localize(
@@ -588,10 +586,11 @@ export class QuickBar extends LitElement {
const item = {
primaryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.server_control.perform_action",
- "action",
- this.hass.localize(
- `ui.dialogs.quick-bar.commands.server_control.${action}`
- )
+ {
+ action: this.hass.localize(
+ `ui.dialogs.quick-bar.commands.server_control.${action}`
+ ),
+ }
),
iconPath: mdiServerNetwork,
categoryText: this.hass.localize(
diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts
index 5efadf1101..f891f6b1f9 100644
--- a/src/layouts/hass-tabs-subpage-data-table.ts
+++ b/src/layouts/hass-tabs-subpage-data-table.ts
@@ -147,11 +147,9 @@ export class HaTabsSubpageDataTable extends LitElement {
protected render(): TemplateResult {
const hiddenLabel = this.numHidden
? this.hiddenLabel ||
- this.hass.localize(
- "ui.components.data-table.hidden",
- "number",
- this.numHidden
- ) ||
+ this.hass.localize("ui.components.data-table.hidden", {
+ number: this.numHidden,
+ }) ||
this.numHidden
: undefined;
diff --git a/src/panels/config/application_credentials/ha-config-application-credentials.ts b/src/panels/config/application_credentials/ha-config-application-credentials.ts
index ec1b97dba3..43a4a4b525 100644
--- a/src/panels/config/application_credentials/ha-config-application-credentials.ts
+++ b/src/panels/config/application_credentials/ha-config-application-credentials.ts
@@ -120,8 +120,7 @@ export class HaConfigApplicationCredentials extends LitElement {
${this.hass.localize(
"ui.panel.config.application_credentials.picker.selected",
- "number",
- this._selected.length
+ { number: this._selected.length }
)}