From f4ee734ea3d466efd1c0efad8615b8009ef62c9c Mon Sep 17 00:00:00 2001 From: Kendell R Date: Tue, 28 Nov 2023 04:29:41 -0800 Subject: [PATCH] Use new localize format (#18574) Co-authored-by: Bram Kragten --- demo/src/custom-cards/ha-demo-card.ts | 3 +- .../addon-store/hassio-addon-repository.ts | 8 +- .../addon-view/config/hassio-addon-config.ts | 16 +-- .../addon-view/config/hassio-addon-network.ts | 16 +-- .../hassio-addon-documentation-tab.ts | 3 +- .../src/addon-view/info/hassio-addon-info.ts | 72 +++++----- .../src/addon-view/log/hassio-addon-logs.ts | 8 +- hassio/src/dashboard/hassio-update.ts | 8 +- .../dialogs/network/dialog-hassio-network.ts | 3 +- hassio/src/hassio-my-redirect.ts | 10 +- hassio/src/system/hassio-core-info.ts | 34 ++--- hassio/src/system/hassio-supervisor-info.ts | 43 +++--- hassio/src/system/hassio-supervisor-log.ts | 11 +- src/auth/ha-auth-flow.ts | 8 +- src/common/translations/localize.ts | 8 +- .../ha-button-related-filter-menu.ts | 21 +-- src/components/ha-file-upload.ts | 2 +- .../media-player/ha-media-player-browse.ts | 10 +- src/data/application_credential.ts | 2 +- src/data/automation_i18n.ts | 8 +- src/data/device_automation.ts | 48 +++---- src/data/device_registry.ts | 10 +- src/data/logbook.ts | 10 +- src/data/script_i18n.ts | 14 +- src/data/update.ts | 4 +- .../dialog-config-entry-system-options.ts | 29 ++-- .../config-flow/show-dialog-config-flow.ts | 3 +- .../config-flow/step-flow-create-entry.ts | 3 +- .../configurator-notification-item.ts | 8 +- src/dialogs/quick-bar/ha-quick-bar.ts | 17 ++- src/layouts/hass-tabs-subpage-data-table.ts | 8 +- .../ha-config-application-credentials.ts | 6 +- .../config/areas/ha-config-areas-dashboard.ts | 47 +++---- .../types/ha-automation-action-choose.ts | 6 +- .../ha-automation-condition-editor.ts | 3 +- .../config/automation/ha-automation-editor.ts | 3 +- .../config/automation/ha-automation-picker.ts | 16 +-- .../trigger/ha-automation-trigger-row.ts | 3 +- .../blueprint/dialog-import-blueprint.ts | 8 +- .../config/cloud/account/cloud-tts-pref.ts | 8 +- .../cloud/account/dialog-cloud-tts-try.ts | 3 +- .../core/ha-config-system-navigation.ts | 30 ++-- .../config/dashboard/ha-config-dashboard.ts | 22 ++- .../device-detail/ha-device-entities-card.ts | 3 +- .../device-detail/ha-device-info-card.ts | 19 +-- .../ha-device-via-devices-card.ts | 3 +- .../mqtt/dialog-mqtt-device-debug-info.ts | 9 +- .../zwave_js/ha-device-info-zwave_js.ts | 3 +- .../dialog-device-registry-detail.ts | 33 ++--- .../config/devices/ha-config-device-page.ts | 130 +++++++++--------- .../devices/ha-config-devices-dashboard.ts | 3 +- .../settings/entity-settings-helper-tab.ts | 3 +- .../entity-registry-settings-editor.ts | 41 +++--- .../entities/entity-registry-settings.ts | 3 +- .../config/entities/ha-config-entities.ts | 29 ++-- .../config/helpers/dialog-helper-detail.ts | 13 +- .../integrations/ha-config-flow-card.ts | 3 +- .../ha-config-integration-page.ts | 21 +-- .../ha-ignored-config-entry-card.ts | 3 +- .../integrations/ha-integration-card.ts | 9 +- .../mqtt/mqtt-subscribe-card.ts | 18 +-- .../integration-panels/zha/zha-device-card.ts | 11 +- .../zha/zha-device-pairing-status-card.ts | 8 +- .../dialog-zwave_js-remove-failed-node.ts | 3 +- .../zwave_js/dialog-zwave_js-remove-node.ts | 3 +- .../zwave_js/zwave_js-node-config.ts | 24 ++-- .../config/logs/dialog-system-log-detail.ts | 10 +- src/panels/config/logs/error-log-card.ts | 5 +- src/panels/config/logs/system-log-card.ts | 14 +- .../config/network/supervisor-network.ts | 3 +- .../config/person/dialog-person-detail.ts | 3 +- src/panels/config/scene/ha-scene-editor.ts | 3 +- src/panels/config/script/ha-script-editor.ts | 11 +- src/panels/config/script/ha-script-picker.ts | 24 ++-- src/panels/config/tags/dialog-tag-detail.ts | 18 +-- src/panels/config/tags/ha-config-tags.ts | 26 ++-- src/panels/config/users/ha-config-users.ts | 3 +- .../voice-assistants/cloud-alexa-pref.ts | 13 +- .../ha-config-voice-assistants-expose.ts | 6 +- src/panels/custom/ha-panel-custom.ts | 5 +- .../event/event-subscribe-card.ts | 3 +- .../service/developer-tools-service.ts | 11 +- .../developer-yaml-config.ts | 3 +- src/panels/lovelace/cards/hui-gauge-card.ts | 6 +- src/panels/lovelace/cards/hui-logbook-card.ts | 8 +- .../cards/hui-weather-forecast-card.ts | 8 +- src/panels/lovelace/common/compute-tooltip.ts | 28 ++-- .../common/generate-lovelace-config.ts | 10 +- src/panels/lovelace/common/handle-action.ts | 11 +- src/panels/lovelace/components/hui-warning.ts | 8 +- .../card-editor/hui-dialog-create-card.ts | 3 +- .../card-editor/hui-dialog-edit-card.ts | 6 +- .../hui-dialog-create-headerfooter.ts | 9 +- .../lovelace/editor/hui-element-editor.ts | 8 +- .../view-editor/hui-dialog-edit-view.ts | 11 +- .../elements/hui-state-label-element.ts | 5 +- .../entity-rows/hui-script-entity-row.ts | 11 +- src/panels/lovelace/hui-editor.ts | 12 +- src/panels/my/ha-panel-my.ts | 40 +++--- .../dialog-ha-mfa-module-setup-flow.ts | 3 +- .../ha-long-lived-access-token-dialog.ts | 3 +- .../ha-long-lived-access-tokens-card.ts | 14 +- src/panels/profile/ha-mfa-modules-card.ts | 8 +- src/state-summary/state-card-script.ts | 8 +- src/state/disconnect-toast-mixin.ts | 8 +- 105 files changed, 596 insertions(+), 791 deletions(-) diff --git a/demo/src/custom-cards/ha-demo-card.ts b/demo/src/custom-cards/ha-demo-card.ts index 74730013ae..1f0d344b92 100644 --- a/demo/src/custom-cards/ha-demo-card.ts +++ b/demo/src/custom-cards/ha-demo-card.ts @@ -48,8 +48,7 @@ export class HADemoCard extends LitElement implements LovelaceCard { ${this.hass.localize( "ui.panel.page-demo.cards.demo.demo_by", - "name", - conf.authorName + { name: conf.authorName } )} diff --git a/hassio/src/addon-store/hassio-addon-repository.ts b/hassio/src/addon-store/hassio-addon-repository.ts index 38cd480298..477a4361ab 100644 --- a/hassio/src/addon-store/hassio-addon-repository.ts +++ b/hassio/src/addon-store/hassio-addon-repository.ts @@ -49,11 +49,9 @@ export class HassioAddonRepositoryEl extends LitElement { return html`

- ${this.supervisor.localize( - "store.no_results_found", - "repository", - repo.name - )} + ${this.supervisor.localize("store.no_results_found", { + repository: repo.name, + })}

`; diff --git a/hassio/src/addon-view/config/hassio-addon-config.ts b/hassio/src/addon-view/config/hassio-addon-config.ts index f73b13f374..75ff632c15 100644 --- a/hassio/src/addon-view/config/hassio-addon-config.ts +++ b/hassio/src/addon-view/config/hassio-addon-config.ts @@ -340,11 +340,9 @@ class HassioAddonConfig extends LitElement { }; fireEvent(this, "hass-api-called", eventdata); } catch (err: any) { - this._error = this.supervisor.localize( - "addon.failed_to_reset", - "error", - extractApiErrorMessage(err) - ); + this._error = this.supervisor.localize("addon.failed_to_reset", { + error: extractApiErrorMessage(err), + }); } button.progress = false; } @@ -381,11 +379,9 @@ class HassioAddonConfig extends LitElement { await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); } } 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), + }); eventdata.success = false; } button.progress = false; diff --git a/hassio/src/addon-view/config/hassio-addon-network.ts b/hassio/src/addon-view/config/hassio-addon-network.ts index 0e315bbf11..56173ab5f5 100644 --- a/hassio/src/addon-view/config/hassio-addon-network.ts +++ b/hassio/src/addon-view/config/hassio-addon-network.ts @@ -180,11 +180,9 @@ class HassioAddonNetwork extends LitElement { await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); } } catch (err: any) { - this._error = this.supervisor.localize( - "addon.failed_to_reset", - "error", - extractApiErrorMessage(err) - ); + this._error = this.supervisor.localize("addon.failed_to_reset", { + error: extractApiErrorMessage(err), + }); button.actionError(); } } @@ -220,11 +218,9 @@ class HassioAddonNetwork extends LitElement { await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); } } 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), + }); button.actionError(); } } diff --git a/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts b/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts index 98cd11b276..905b21ea36 100644 --- a/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts +++ b/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts @@ -85,8 +85,7 @@ class HassioAddonDocumentationDashboard extends LitElement { } catch (err: any) { this._error = this.supervisor.localize( "addon.documentation.get_documentation", - "error", - extractApiErrorMessage(err) + { error: extractApiErrorMessage(err) } ); } } diff --git a/hassio/src/addon-view/info/hassio-addon-info.ts b/hassio/src/addon-view/info/hassio-addon-info.ts index 074b8e08da..ae59d0af6b 100644 --- a/hassio/src/addon-view/info/hassio-addon-info.ts +++ b/hassio/src/addon-view/info/hassio-addon-info.ts @@ -451,13 +451,14 @@ class HassioAddonInfo extends LitElement {
${this.addon.description}.
- ${this.supervisor.localize( - "addon.dashboard.visit_addon_page", - "name", - html`${this.addon.name}` - )} + >`, + })}
@@ -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 } )}

@@ -178,8 +177,7 @@ export class HaConfigApplicationCredentials extends LitElement { showConfirmationDialog(this, { title: this.hass.localize( `ui.panel.config.application_credentials.picker.remove_selected.confirm_title`, - "number", - this._selected.length + { number: this._selected.length } ), text: this.hass.localize( "ui.panel.config.application_credentials.picker.remove_selected.confirm_text" diff --git a/src/panels/config/areas/ha-config-areas-dashboard.ts b/src/panels/config/areas/ha-config-areas-dashboard.ts index 5b03220dec..3623d58557 100644 --- a/src/panels/config/areas/ha-config-areas-dashboard.ts +++ b/src/panels/config/areas/ha-config-areas-dashboard.ts @@ -1,9 +1,10 @@ import { mdiHelpCircle, mdiPlus } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; +import { formatListWithAnds } from "../../../common/string/format-list"; import "../../../components/ha-fab"; import "../../../components/ha-icon-button"; import "../../../components/ha-svg-icon"; @@ -135,36 +136,26 @@ export class HaConfigAreasDashboard extends SubscribeMixin(LitElement) {

${area.name}

- ${area.devices - ? html` - ${this.hass.localize( + ${formatListWithAnds( + this.hass.locale, + [ + area.devices && + this.hass.localize( "ui.panel.config.integrations.config_entry.devices", - "count", - area.devices - )}${area.services ? "," : ""} - ` - : ""} - ${area.services - ? html` - ${this.hass.localize( + { count: area.devices } + ), + area.services && + this.hass.localize( "ui.panel.config.integrations.config_entry.services", - "count", - area.services - )} - ` - : ""} - ${(area.devices || area.services) && area.entities - ? this.hass.localize("ui.common.and") - : ""} - ${area.entities - ? html` - ${this.hass.localize( + { count: area.services } + ), + area.entities && + this.hass.localize( "ui.panel.config.integrations.config_entry.entities", - "count", - area.entities - )} - ` - : ""} + { count: area.entities } + ), + ].filter((v): v is string => Boolean(v)) + )}
1) { str += this.hass.localize( "ui.panel.config.automation.editor.actions.type.choose.option_description_additional", - "numberOfAdditionalConditions", - conditions.length - 1 + { numberOfAdditionalConditions: conditions.length - 1 } ); } return str; @@ -115,8 +114,7 @@ export class HaChooseAction extends LitElement implements ActionElement {

${this.hass.localize( "ui.panel.config.automation.editor.actions.type.choose.option", - "number", - idx + 1 + { number: idx + 1 } )}: ${option.alias || (this._expandedStates[idx] diff --git a/src/panels/config/automation/condition/ha-automation-condition-editor.ts b/src/panels/config/automation/condition/ha-automation-condition-editor.ts index ade44fa4e1..81b4eec95b 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-editor.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-editor.ts @@ -49,8 +49,7 @@ export default class HaAutomationConditionEditor extends LitElement { ? html` ${this.hass.localize( "ui.panel.config.automation.editor.conditions.unsupported_condition", - "condition", - condition.condition + { condition: condition.condition } )} ` : ""} diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index e63bc8f211..c06c73ba3e 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -549,8 +549,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { ) : this.hass.localize( "ui.panel.config.automation.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); history.back(); diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index f68d0b7877..2e0c917086 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -352,10 +352,12 @@ class HaAutomationPicker extends LitElement { this._activeFilters = [ this.hass.localize( "ui.panel.config.automation.picker.filtered_by_blueprint", - "name", - !blueprintMeta || "error" in blueprintMeta - ? blueprint - : blueprintMeta.metadata.name || blueprint + { + name: + !blueprintMeta || "error" in blueprintMeta + ? blueprint + : blueprintMeta.metadata.name || blueprint, + } ), ]; } @@ -431,8 +433,7 @@ class HaAutomationPicker extends LitElement { ) : this.hass.localize( "ui.panel.config.automation.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); } @@ -457,8 +458,7 @@ class HaAutomationPicker extends LitElement { await showAlertDialog(this, { text: this.hass.localize( "ui.panel.config.automation.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); } diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts index 9df81236ec..128f7288be 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -322,8 +322,7 @@ export default class HaAutomationTriggerRow extends LitElement { ? html` ${this.hass.localize( "ui.panel.config.automation.editor.triggers.unsupported_platform", - "platform", - this.trigger.platform + { platform: this.trigger.platform } )} ` : ""} diff --git a/src/panels/config/blueprint/dialog-import-blueprint.ts b/src/panels/config/blueprint/dialog-import-blueprint.ts index adb7d03ba8..b6d498c133 100644 --- a/src/panels/config/blueprint/dialog-import-blueprint.ts +++ b/src/panels/config/blueprint/dialog-import-blueprint.ts @@ -68,10 +68,10 @@ class DialogImportBlueprint extends LitElement { ${this._result ? html`${this.hass.localize( "ui.panel.config.blueprint.add.import_header", - "name", - html`${this._result.blueprint.metadata.name}`, - "domain", - this._result.blueprint.metadata.domain + { + name: html`${this._result.blueprint.metadata.name}`, + domain: this._result.blueprint.metadata.domain, + } )}
- ${this.hass.localize( - "ui.panel.config.cloud.account.tts.info", - "service", - '"tts.cloud_say"' - )} + ${this.hass.localize("ui.panel.config.cloud.account.tts.info", { + service: '"tts.cloud_say"', + })}

diff --git a/src/panels/config/core/ha-config-system-navigation.ts b/src/panels/config/core/ha-config-system-navigation.ts index ecbe8fdfa5..c2d0f73c77 100644 --- a/src/panels/config/core/ha-config-system-navigation.ts +++ b/src/panels/config/core/ha-config-system-navigation.ts @@ -55,14 +55,12 @@ class HaConfigSystemNavigation extends LitElement { switch (page.translationKey) { case "backup": description = this._latestBackupDate - ? this.hass.localize( - "ui.panel.config.backup.description", - "relative_time", - relativeTime( + ? this.hass.localize("ui.panel.config.backup.description", { + relative_time: relativeTime( new Date(this._latestBackupDate), this.hass.locale - ) - ) + ), + }) : this.hass.localize( "ui.panel.config.backup.description_no_backup" ); @@ -70,23 +68,21 @@ class HaConfigSystemNavigation extends LitElement { case "network": description = this.hass.localize( "ui.panel.config.network.description", - "state", - this._externalAccess - ? this.hass.localize("ui.panel.config.network.enabled") - : this.hass.localize("ui.panel.config.network.disabled") + { + state: this._externalAccess + ? this.hass.localize("ui.panel.config.network.enabled") + : this.hass.localize("ui.panel.config.network.disabled"), + } ); break; case "storage": description = this._storageInfo - ? this.hass.localize( - "ui.panel.config.storage.description", - "percent_used", - `${Math.round( + ? this.hass.localize("ui.panel.config.storage.description", { + percent_used: `${Math.round( (this._storageInfo.used / this._storageInfo.total) * 100 )}${blankBeforePercent(this.hass.locale)}%`, - "free_space", - `${this._storageInfo.free} GB` - ) + free_space: `${this._storageInfo.free} GB`, + }) : ""; break; case "hardware": diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 9cd8a390ec..2ed6a9bb8f 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -56,46 +56,40 @@ const randomTip = (hass: HomeAssistant, narrow: boolean) => { const weighted: string[] = []; let tips = [ { - content: hass.localize( - "ui.panel.config.tips.join", - "forums", - html`Forums`, - "twitter", - html`Twitter`, - "discord", - html`Chat`, - "blog", - html`Blog`, - "newsletter", - html`Newsletter - ` - ), + `, + }), weight: 2, narrow: true, }, diff --git a/src/panels/config/devices/device-detail/ha-device-entities-card.ts b/src/panels/config/devices/device-detail/ha-device-entities-card.ts index 5ec3e3c8b0..fb5aad023e 100644 --- a/src/panels/config/devices/device-detail/ha-device-entities-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-entities-card.ts @@ -103,8 +103,7 @@ export class HaDeviceEntitiesCard extends LitElement { ` diff --git a/src/panels/config/devices/device-detail/ha-device-info-card.ts b/src/panels/config/devices/device-detail/ha-device-info-card.ts index 011adbe3da..0a7de52392 100644 --- a/src/panels/config/devices/device-detail/ha-device-info-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-info-card.ts @@ -27,15 +27,13 @@ export class HaDeviceCard extends LitElement { return html`
${this.device.model @@ -46,8 +44,7 @@ export class HaDeviceCard extends LitElement {
${this.hass.localize( "ui.panel.config.integrations.config_entry.manuf", - "manufacturer", - this.device.manufacturer + { manufacturer: this.device.manufacturer } )}
` @@ -80,8 +77,7 @@ export class HaDeviceCard extends LitElement { ? "version" : "firmware" }`, - "version", - this.device.sw_version + { version: this.device.sw_version } )}
` @@ -91,8 +87,7 @@ export class HaDeviceCard extends LitElement {
${this.hass.localize( "ui.panel.config.integrations.config_entry.hardware", - "version", - this.device.hw_version + { version: this.device.hw_version } )}
` diff --git a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts index fd75189514..aa664ce9e0 100644 --- a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts @@ -69,8 +69,7 @@ export class HaDeviceViaDevicesCard extends LitElement { ` diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts index d3d15a4a28..790df95b67 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts @@ -59,8 +59,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement { @closed=${this._close} .heading=${this.hass!.localize( "ui.dialogs.mqtt_device_debug_info.title", - "device", - computeDeviceName(this._params.device, this.hass) + { device: computeDeviceName(this._params.device, this.hass) } )} >

@@ -179,8 +178,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement { .subscribedTopic=${topic.topic} .summary=${this.hass!.localize( "ui.dialogs.mqtt_device_debug_info.recent_messages", - "n", - topic.messages.length + { n: topic.messages.length } )} > @@ -203,8 +201,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement { .subscribedTopic=${topic.topic} .summary=${this.hass!.localize( "ui.dialogs.mqtt_device_debug_info.recent_tx_messages", - "n", - topic.messages.length + { n: topic.messages.length } )} > diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index eced1b42a2..07671142ba 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -127,8 +127,7 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { ${this._node.zwave_plus_version ? this.hass.localize( "ui.panel.config.zwave_js.device_info.zwave_plus_version", - "version", - this._node.zwave_plus_version + { version: this._node.zwave_plus_version } ) : this.hass.localize("ui.common.no")}

diff --git a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts index 204d115b24..13b5c0ab98 100644 --- a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts @@ -90,28 +90,29 @@ class DialogDeviceRegistryDetail extends LitElement {
${this.hass.localize( "ui.dialogs.device-registry-detail.enabled_label", - "type", - this.hass.localize( - `ui.dialogs.device-registry-detail.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.dialogs.device-registry-detail.type.${ + device.entry_type || "device" + }` + ), + } )}
${this._disabledBy && this._disabledBy !== "user" ? this.hass.localize( "ui.dialogs.device-registry-detail.enabled_cause", - "type", - this.hass.localize( - `ui.dialogs.device-registry-detail.type.${ - device.entry_type || "device" - }` - ), - "cause", - this.hass.localize( - `config_entry.disabled_by.${this._disabledBy}` - ) + { + type: this.hass.localize( + `ui.dialogs.device-registry-detail.type.${ + device.entry_type || "device" + }` + ), + cause: this.hass.localize( + `config_entry.disabled_by.${this._disabledBy}` + ), + } ) : ""} ${this.hass.localize( diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index 1131d5214e..71fd2983b6 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -387,17 +387,14 @@ export class HaConfigDevicePage extends LitElement { if (device.disabled_by) { deviceInfo.push(html` - ${this.hass.localize( - "ui.panel.config.devices.enabled_cause", - "type", - this.hass.localize( + ${this.hass.localize("ui.panel.config.devices.enabled_cause", { + type: this.hass.localize( `ui.panel.config.devices.type.${device.entry_type || "device"}` ), - "cause", - this.hass.localize( + cause: this.hass.localize( `ui.panel.config.devices.disabled_by.${device.disabled_by}` - ) - )} + ), + })} ${device.disabled_by === "user" ? html` @@ -426,12 +423,13 @@ export class HaConfigDevicePage extends LitElement { .label=${device.disabled_by ? this.hass.localize( "ui.panel.config.devices.automation.create_disable", - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } ) : this.hass.localize( "ui.panel.config.devices.automation.create", @@ -486,19 +484,16 @@ export class HaConfigDevicePage extends LitElement { ` : html`
- ${this.hass.localize( - "ui.panel.config.devices.add_prompt", - "name", - this.hass.localize( + ${this.hass.localize("ui.panel.config.devices.add_prompt", { + name: this.hass.localize( "ui.panel.config.devices.automation.automations" ), - "type", - this.hass.localize( + type: this.hass.localize( `ui.panel.config.devices.type.${ device.entry_type || "device" }` - ) - )} + ), + })}
`} @@ -520,21 +515,23 @@ export class HaConfigDevicePage extends LitElement { .label=${device.disabled_by ? this.hass.localize( "ui.panel.config.devices.scene.create_disable", - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } ) : this.hass.localize( "ui.panel.config.devices.scene.create", - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } )} .path=${mdiPlusCircle} > @@ -583,16 +580,16 @@ export class HaConfigDevicePage extends LitElement {
${this.hass.localize( "ui.panel.config.devices.add_prompt", - "name", - this.hass.localize( - "ui.panel.config.devices.scene.scenes" - ), - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + name: this.hass.localize( + "ui.panel.config.devices.scene.scenes" + ), + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } )}
`} @@ -613,21 +610,23 @@ export class HaConfigDevicePage extends LitElement { .label=${device.disabled_by ? this.hass.localize( "ui.panel.config.devices.script.create_disable", - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } ) : this.hass.localize( "ui.panel.config.devices.script.create", - "type", - this.hass.localize( - `ui.panel.config.devices.type.${ - device.entry_type || "device" - }` - ) + { + type: this.hass.localize( + `ui.panel.config.devices.type.${ + device.entry_type || "device" + }` + ), + } )} .path=${mdiPlusCircle} > @@ -661,19 +660,16 @@ export class HaConfigDevicePage extends LitElement { ` : html`
- ${this.hass.localize( - "ui.panel.config.devices.add_prompt", - "name", - this.hass.localize( + ${this.hass.localize("ui.panel.config.devices.add_prompt", { + name: this.hass.localize( "ui.panel.config.devices.script.scripts" ), - "type", - this.hass.localize( + type: this.hass.localize( `ui.panel.config.devices.type.${ device.entry_type || "device" }` - ) - )} + ), + })}
`} @@ -703,8 +699,7 @@ export class HaConfigDevicePage extends LitElement { ${this.hass.localize( "ui.panel.config.integrations.config_entry.area", - "area", - area.name || "Unnamed Area" + { area: area.name || "Unnamed Area" } )}
` @@ -1265,8 +1260,7 @@ export class HaConfigDevicePage extends LitElement { (await showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.config.devices.confirm_disable_config_entry", - "entry_name", - config_entry.title + { entry_name: config_entry.title } ), confirmText: this.hass.localize("ui.common.yes"), dismissText: this.hass.localize("ui.common.no"), diff --git a/src/panels/config/devices/ha-config-devices-dashboard.ts b/src/panels/config/devices/ha-config-devices-dashboard.ts index 8aaeed95be..3ec2e99554 100644 --- a/src/panels/config/devices/ha-config-devices-dashboard.ts +++ b/src/panels/config/devices/ha-config-devices-dashboard.ts @@ -469,8 +469,7 @@ export class HaConfigDeviceDashboard extends LitElement { )} .hiddenLabel=${this.hass.localize( "ui.panel.config.devices.picker.filter.hidden_devices", - "number", - this._numHiddenDevices + { number: this._numHiddenDevices } )} .columns=${this._columns( this.hass.localize, diff --git a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts index 058363a974..4aa5587994 100644 --- a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts +++ b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts @@ -82,8 +82,7 @@ export class EntityRegistrySettingsHelper extends LitElement { ${!this._componentLoaded ? this.hass.localize( "ui.dialogs.helper_settings.platform_not_loaded", - "platform", - this.entry.platform + { platform: this.entry.platform } ) : this._item === null ? this.hass.localize("ui.dialogs.helper_settings.yaml_not_editable") diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index ff3330fa2c..86e1405aa4 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -790,21 +790,23 @@ export class EntityRegistrySettingsEditor extends LitElement { ${this.hass.localize( "ui.dialogs.entity_registry.editor.configure_state", - "integration", - domainToName( - this.hass.localize, - this.helperConfigEntry.domain - ) + { + integration: domainToName( + this.hass.localize, + this.helperConfigEntry.domain + ), + } )} ${this.hass.localize( "ui.dialogs.entity_registry.editor.configure_state_secondary", - "integration", - domainToName( - this.hass.localize, - this.helperConfigEntry.domain - ) + { + integration: domainToName( + this.hass.localize, + this.helperConfigEntry.domain + ), + } )} @@ -842,10 +844,11 @@ export class EntityRegistrySettingsEditor extends LitElement { ? html`${this.hass.localize( "ui.dialogs.entity_registry.editor.enabled_cause", - "cause", - this.hass.localize( - `config_entry.disabled_by.${this._disabledBy!}` - ) + { + cause: this.hass.localize( + `config_entry.disabled_by.${this._disabledBy!}` + ), + } )}` : ""} @@ -876,8 +879,11 @@ export class EntityRegistrySettingsEditor extends LitElement { ? html`${this.hass.localize( "ui.dialogs.entity_registry.editor.hidden_cause", - "cause", - this.hass.localize(`config_entry.hidden_by.${this._hiddenBy!}`) + { + cause: this.hass.localize( + `config_entry.hidden_by.${this._hiddenBy!}` + ), + } )}` : ""} @@ -1050,8 +1056,7 @@ export class EntityRegistrySettingsEditor extends LitElement { showAlertDialog(this, { text: this.hass.localize( "ui.dialogs.entity_registry.editor.enabled_delay_confirm", - "delay", - result.reload_delay + { delay: result.reload_delay } ), }); } diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 6dd889cb71..ebb1f5f1b9 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -184,8 +184,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { showAlertDialog(this, { text: this.hass.localize( "ui.dialogs.entity_registry.editor.enabled_delay_confirm", - "delay", - result.reload_delay + { delay: result.reload_delay } ), }); } diff --git a/src/panels/config/entities/ha-config-entities.ts b/src/panels/config/entities/ha-config-entities.ts index 0986115af7..e672f9120c 100644 --- a/src/panels/config/entities/ha-config-entities.ts +++ b/src/panels/config/entities/ha-config-entities.ts @@ -525,8 +525,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { )} .hiddenLabel=${this.hass.localize( "ui.panel.config.entities.picker.filter.hidden_entities", - "number", - this._numHiddenEntities + { number: this._numHiddenEntities } )} .filter=${this._filter} selectable @@ -554,8 +553,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {

${this.hass.localize( "ui.panel.config.entities.picker.selected", - "number", - this._selectedEntities.length + { number: this._selectedEntities.length } )}

@@ -797,8 +795,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.config.entities.picker.enable_selected.confirm_title", - "number", - this._selectedEntities.length + { number: this._selectedEntities.length } ), text: this.hass.localize( "ui.panel.config.entities.picker.enable_selected.confirm_text" @@ -834,8 +831,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { showAlertDialog(this, { text: this.hass.localize( "ui.dialogs.entity_registry.editor.enabled_delay_confirm", - "delay", - reload_delay + { delay: reload_delay } ), }); } @@ -847,8 +843,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.config.entities.picker.disable_selected.confirm_title", - "number", - this._selectedEntities.length + { number: this._selectedEntities.length } ), text: this.hass.localize( "ui.panel.config.entities.picker.disable_selected.confirm_text" @@ -870,8 +865,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.config.entities.picker.hide_selected.confirm_title", - "number", - this._selectedEntities.length + { number: this._selectedEntities.length } ), text: this.hass.localize( "ui.panel.config.entities.picker.hide_selected.confirm_text" @@ -901,8 +895,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { ? "partly_" : "" }title`, - "number", - removeableEntities.length + { number: removeableEntities.length } ), text: removeableEntities.length === this._selectedEntities.length @@ -911,10 +904,10 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { ) : this.hass.localize( "ui.panel.config.entities.picker.remove_selected.confirm_partly_text", - "removable", - removeableEntities.length, - "selected", - this._selectedEntities.length + { + removable: removeableEntities.length, + selected: this._selectedEntities.length, + } ), confirmText: this.hass.localize("ui.common.remove"), dismissText: this.hass.localize("ui.common.cancel"), diff --git a/src/panels/config/helpers/dialog-helper-detail.ts b/src/panels/config/helpers/dialog-helper-detail.ts index 24fdeddf60..60a3731840 100644 --- a/src/panels/config/helpers/dialog-helper-detail.ts +++ b/src/panels/config/helpers/dialog-helper-detail.ts @@ -225,8 +225,7 @@ export class DialogHelperDetail extends LitElement { ${this.hass.localize( "ui.dialogs.helper_settings.platform_not_loaded", - "platform", - domain + { platform: domain } )} ` @@ -250,10 +249,12 @@ export class DialogHelperDetail extends LitElement { this._domain ? this.hass.localize( "ui.panel.config.helpers.dialog.create_platform", - "platform", - this.hass.localize( - `ui.panel.config.helpers.types.${this._domain}` - ) || this._domain + { + platform: + this.hass.localize( + `ui.panel.config.helpers.types.${this._domain}` + ) || this._domain, + } ) : this.hass.localize("ui.panel.config.helpers.dialog.create_helper") )} diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index 2af91dcb2a..ad7df5b414 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -135,8 +135,7 @@ export class HaConfigFlowCard extends LitElement { const confirmed = await showConfirmationDialog(this, { title: this.hass!.localize( "ui.panel.config.integrations.ignore.confirm_ignore_title", - "name", - localizeConfigFlowTitle(this.hass.localize, this.flow) + { name: localizeConfigFlowTitle(this.hass.localize, this.flow) } ), text: this.hass!.localize( "ui.panel.config.integrations.ignore.confirm_ignore" diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 55d4ee7323..628f3635e8 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -306,8 +306,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { `ui.panel.config.integrations.config_entry.${ services ? "services" : "devices" }`, - "count", - devices.length + { count: devices.length } )} @@ -324,8 +323,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { > ${this.hass.localize( `ui.panel.config.integrations.config_entry.entities`, - "count", - entities.length + { count: entities.length } )} @@ -606,8 +604,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { html`${this.hass.localize( `ui.panel.config.integrations.config_entry.${localizeKey}`, - "count", - items.length + { count: items.length } )}` ); @@ -620,8 +617,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { href=${`/config/entities?historyBack=1&config_entry=${item.entry_id}`} >${this.hass.localize( "ui.panel.config.integrations.config_entry.entities", - "count", - entities.length + { count: entities.length } )}` ); @@ -730,8 +726,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { ${this.hass.localize( `ui.panel.config.integrations.config_entry.devices`, - "count", - devices.length + { count: devices.length } )} @@ -750,8 +745,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { > ${this.hass.localize( `ui.panel.config.integrations.config_entry.services`, - "count", - services.length + { count: services.length } )} @@ -768,8 +762,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { > ${this.hass.localize( `ui.panel.config.integrations.config_entry.entities`, - "count", - entities.length + { count: entities.length } )} diff --git a/src/panels/config/integrations/ha-ignored-config-entry-card.ts b/src/panels/config/integrations/ha-ignored-config-entry-card.ts index 775343f7a7..f00d481d37 100644 --- a/src/panels/config/integrations/ha-ignored-config-entry-card.ts +++ b/src/panels/config/integrations/ha-ignored-config-entry-card.ts @@ -47,8 +47,7 @@ export class HaIgnoredConfigEntryCard extends LitElement { showConfirmationDialog(this, { title: this.hass!.localize( "ui.panel.config.integrations.ignore.confirm_delete_ignore_title", - "name", - this.hass.localize(`component.${this.entry.domain}.title`) + { name: this.hass.localize(`component.${this.entry.domain}.title`) } ), text: this.hass!.localize( "ui.panel.config.integrations.ignore.confirm_delete_ignore" diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 13af779372..4fdafdba2c 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -140,8 +140,7 @@ export class HaIntegrationCard extends LitElement { `ui.panel.config.integrations.config_entry.${ services ? "services" : "devices" }`, - "count", - devices.length + { count: devices.length } )} ` @@ -152,8 +151,7 @@ export class HaIntegrationCard extends LitElement { ${this.hass.localize( `ui.panel.config.integrations.config_entry.entities`, - "count", - entities.length + { count: entities.length } )} ` @@ -161,8 +159,7 @@ export class HaIntegrationCard extends LitElement { ${this.hass.localize( `ui.panel.config.integrations.config_entry.entries`, - "count", - this.items.length + { count: this.items.length } )} `} diff --git a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts index b1bf864377..a4501073b1 100644 --- a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts +++ b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts @@ -110,15 +110,15 @@ class MqttSubscribeCard extends LitElement { ${this._messages.map( (msg) => html`
- ${this.hass.localize( - "ui.panel.config.mqtt.message_received", - "id", - msg.id, - "topic", - msg.message.topic, - "time", - formatTime(msg.time, this.hass!.locale, this.hass!.config) - )} + ${this.hass.localize("ui.panel.config.mqtt.message_received", { + id: msg.id, + topic: msg.message.topic, + time: formatTime( + msg.time, + this.hass!.locale, + this.hass!.config + ), + })}
${msg.payload}
QoS: ${msg.message.qos} - Retain: diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index 5d4f476491..9544fa6bc8 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -78,11 +78,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
${this.device.model}
- ${this.hass.localize( - "ui.dialogs.zha_device_info.manuf", - "manufacturer", - this.device.manufacturer - )} + ${this.hass.localize("ui.dialogs.zha_device_info.manuf", { + manufacturer: this.device.manufacturer, + })}
@@ -191,8 +189,7 @@ class ZHADeviceCard extends SubscribeMixin(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/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts index a921a602ec..07d540e43c 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts @@ -54,11 +54,9 @@ class ZHADevicePairingStatusCard extends LitElement { ? html`
${this.device.model}
- ${this.hass.localize( - "ui.dialogs.zha_device_info.manuf", - "manufacturer", - this.device.manufacturer - )} + ${this.hass.localize("ui.dialogs.zha_device_info.manuf", { + manufacturer: this.device.manufacturer, + })}
` : nothing} diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts index a7a0494e47..6b22e7a12e 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts @@ -138,8 +138,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {

${this.hass.localize( "ui.panel.config.zwave_js.remove_failed_node.removal_finished", - "id", - this._node!.node_id + { id: this._node!.node_id } )}

diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts index 8db12606c4..461936dc44 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts @@ -125,8 +125,7 @@ class DialogZWaveJSRemoveNode extends LitElement {

${this.hass.localize( "ui.panel.config.zwave_js.remove_node.exclusion_finished", - "id", - this._node!.node_id + { id: this._node!.node_id } )}

diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts index 0117e068da..df90deec41 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts @@ -160,16 +160,17 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) { ${this.hass.localize( "ui.panel.config.zwave_js.node_config.attribution", - "device_database", - html`${this.hass.localize( - "ui.panel.config.zwave_js.node_config.zwave_js_device_database" - )}` + { + device_database: html`${this.hass.localize( + "ui.panel.config.zwave_js.node_config.zwave_js_device_database" + )}`, + } )}

@@ -184,8 +185,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {

${this.hass.localize( "ui.panel.config.zwave_js.node_config.endpoint", - "endpoint", - endpoint + { endpoint } )}

diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index 4856efdb98..5e047d7b07 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -69,13 +69,11 @@ class DialogSystemLogDetail extends LitElement { // Custom components with our official docs should not link to our docs !this._manifest.documentation.includes("://www.home-assistant.io")); - const title = this.hass.localize( - "ui.panel.config.logs.details", - "level", - html`${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}` - ); + >`, + }); return html` diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts index 9930ee59e7..e7c88ef4ac 100644 --- a/src/panels/config/logs/error-log-card.ts +++ b/src/panels/config/logs/error-log-card.ts @@ -179,10 +179,7 @@ class ErrorLogCard extends LitElement { } catch (err: any) { this._error = this.hass.localize( "ui.panel.config.logs.failed_get_logs", - "provider", - this.provider, - "error", - extractApiErrorMessage(err) + { provider: this.provider, error: extractApiErrorMessage(err) } ); return; } diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index 49a41880c7..296908488c 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -47,17 +47,14 @@ export class SystemLogCard extends LitElement { } private _multipleMessages(item: LoggedError): string { - return this.hass.localize( - "ui.panel.config.logs.multiple_messages", - "time", - formatSystemLogTime( + return this.hass.localize("ui.panel.config.logs.multiple_messages", { + time: formatSystemLogTime( item.first_occurred, this.hass.locale, this.hass.config ), - "counter", - item.count - ); + counter: item.count, + }); } private _getFilteredItems = memoizeOne( @@ -122,8 +119,7 @@ export class SystemLogCard extends LitElement { ? html`
${this.hass.localize( "ui.panel.config.logs.no_issues_search", - "term", - this.filter + { term: this.filter } )}
` : filteredItems.map( diff --git a/src/panels/config/network/supervisor-network.ts b/src/panels/config/network/supervisor-network.ts index faaa0a2100..db6d00a086 100644 --- a/src/panels/config/network/supervisor-network.ts +++ b/src/panels/config/network/supervisor-network.ts @@ -116,8 +116,7 @@ export class HassioNetwork extends LitElement { ? html`

${this.hass.localize( "ui.panel.config.network.supervisor.connected_to", - "ssid", - this._interface?.wifi?.ssid + { ssid: this._interface?.wifi?.ssid } )}

` : ""} diff --git a/src/panels/config/person/dialog-person-detail.ts b/src/panels/config/person/dialog-person-detail.ts index 9273ea02f8..92ee079d7d 100644 --- a/src/panels/config/person/dialog-person-detail.ts +++ b/src/panels/config/person/dialog-person-detail.ts @@ -306,8 +306,7 @@ class DialogPersonDetail extends LitElement { !(await showConfirmationDialog(this, { text: this.hass!.localize( "ui.panel.config.person.detail.confirm_delete_user", - "name", - this._name + { name: this._name } ), confirmText: this.hass!.localize( "ui.panel.config.person.detail.delete" diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 6328c68c9c..ea28abb08b 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -589,8 +589,7 @@ export class HaSceneEditor extends SubscribeMixin( ) : this.hass.localize( "ui.panel.config.scene.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); history.back(); diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts index 5652ed607e..0f00810cc0 100644 --- a/src/panels/config/script/ha-script-editor.ts +++ b/src/panels/config/script/ha-script-editor.ts @@ -483,8 +483,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { ) : this.hass.localize( "ui.panel.config.script.editor.load_error_unknown", - "err_no", - resp.status_code || resp.code + { err_no: resp.status_code || resp.code } ) ); history.back(); @@ -628,11 +627,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { ev.stopPropagation(); await triggerScript(this.hass, this.scriptId!); showToast(this, { - message: this.hass.localize( - "ui.notification_toast.triggered", - "name", - this._config!.alias - ), + message: this.hass.localize("ui.notification_toast.triggered", { + name: this._config!.alias, + }), }); } diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index 179acd6c21..59a05f6b9e 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -303,10 +303,12 @@ class HaScriptPicker extends LitElement { this._activeFilters = [ this.hass.localize( "ui.panel.config.script.picker.filtered_by_blueprint", - "name", - !blueprintMeta || "error" in blueprintMeta - ? blueprint - : blueprintMeta.metadata.name || blueprint + { + name: + !blueprintMeta || "error" in blueprintMeta + ? blueprint + : blueprintMeta.metadata.name || blueprint, + } ), ]; } @@ -353,11 +355,9 @@ class HaScriptPicker extends LitElement { } await triggerScript(this.hass, entry.unique_id); showToast(this, { - message: this.hass.localize( - "ui.notification_toast.triggered", - "name", - computeStateName(script) - ), + message: this.hass.localize("ui.notification_toast.triggered", { + name: computeStateName(script), + }), }); }; @@ -419,8 +419,7 @@ class HaScriptPicker extends LitElement { await showAlertDialog(this, { text: this.hass.localize( "ui.panel.config.script.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); } @@ -459,8 +458,7 @@ class HaScriptPicker extends LitElement { ) : this.hass.localize( "ui.panel.config.script.editor.load_error_unknown", - "err_no", - err.status_code + { err_no: err.status_code } ), }); } diff --git a/src/panels/config/tags/dialog-tag-detail.ts b/src/panels/config/tags/dialog-tag-detail.ts index 0026fa4668..7f402f2d4a 100644 --- a/src/panels/config/tags/dialog-tag-detail.ts +++ b/src/panels/config/tags/dialog-tag-detail.ts @@ -118,18 +118,16 @@ class DialogTagDetail ? html`

- ${this.hass!.localize( - "ui.panel.config.tag.detail.usage", - "companion_link", - html`${this.hass!.localize( "ui.panel.config.tag.detail.companion_apps" )}` - )} + >`, + })}

${this._qrCode @@ -251,11 +249,9 @@ class DialogTagDetail ); this._qrCode = html`${this.hass.localize(`; } diff --git a/src/panels/config/tags/ha-config-tags.ts b/src/panels/config/tags/ha-config-tags.ts index 4ac788eba2..5eb80452e2 100644 --- a/src/panels/config/tags/ha-config-tags.ts +++ b/src/panels/config/tags/ha-config-tags.ts @@ -207,11 +207,9 @@ export class HaConfigTags extends SubscribeMixin(LitElement) { private _handleAutomationClick = (ev: Event) => { const tag = (ev.currentTarget as any).tag; const data = { - alias: this.hass.localize( - "ui.panel.config.tag.automation_title", - "name", - tag.name || tag.id - ), + alias: this.hass.localize("ui.panel.config.tag.automation_title", { + name: tag.name || tag.id, + }), trigger: [{ platform: "tag", tag_id: tag.id } as TagTrigger], }; showAutomationEditor(data); @@ -225,18 +223,16 @@ export class HaConfigTags extends SubscribeMixin(LitElement) { title: this.hass.localize("ui.panel.config.tag.caption"), text: html`

- ${this.hass.localize( - "ui.panel.config.tag.detail.usage", - "companion_link", - html`${this.hass!.localize( "ui.panel.config.tag.detail.companion_apps" )}` - )} + >`, + })}

${this.hass.localize( "ui.panel.config.entities.picker.selected", - "number", - this._selectedEntities.length + { number: this._selectedEntities.length } )}

diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 203983d64c..9d685a1893 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -102,10 +102,7 @@ export class HaPanelCustom extends ReactiveElement { !confirm( `${this.hass.localize( "ui.panel.custom.external_panel.question_trust", - "name", - config.name, - "link", - tempA.href + { name: config.name, link: tempA.href } )} ${this.hass.localize( diff --git a/src/panels/developer-tools/event/event-subscribe-card.ts b/src/panels/developer-tools/event/event-subscribe-card.ts index d6fc035474..628ddfd8ef 100644 --- a/src/panels/developer-tools/event/event-subscribe-card.ts +++ b/src/panels/developer-tools/event/event-subscribe-card.ts @@ -74,8 +74,7 @@ class EventSubscribeCard extends LitElement {
${this.hass!.localize( "ui.panel.developer-tools.tabs.events.event_fired", - "name", - event.id + { name: event.id } )} ${formatTime( new Date(event.event.time_fired), diff --git a/src/panels/developer-tools/service/developer-tools-service.ts b/src/panels/developer-tools/service/developer-tools-service.ts index c5624ec25d..1faba95ee5 100644 --- a/src/panels/developer-tools/service/developer-tools-service.ts +++ b/src/panels/developer-tools/service/developer-tools-service.ts @@ -332,8 +332,7 @@ class HaPanelDevService extends LitElement { ) { return localize( `ui.panel.developer-tools.tabs.services.errors.${errorCategory}.missing_required_field`, - "key", - field.key + { key: field.key } ); } } @@ -426,11 +425,9 @@ class HaPanelDevService extends LitElement { forwardHaptic("failure"); button.actionError(); this._error = - this.hass.localize( - "ui.notification_toast.service_call_failed", - "service", - this._serviceData!.service! - ) + ` ${err.message}`; + this.hass.localize("ui.notification_toast.service_call_failed", { + service: this._serviceData!.service!, + }) + ` ${err.message}`; return; } button.actionSuccess(); diff --git a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts index 74f121b15b..fc42da1eba 100644 --- a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts +++ b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts @@ -186,8 +186,7 @@ export class DeveloperYamlConfig extends LitElement { ) || this.hass.localize( "ui.panel.developer-tools.tabs.yaml.section.reloading.reload", - "domain", - domainToName(this.hass.localize, domain) + { domain: domainToName(this.hass.localize, domain) } )}
diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 8edb38253a..0204408063 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -104,8 +104,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { ${this.hass.localize( "ui.panel.lovelace.warning.entity_unavailable", - "entity", - this._config.entity + { entity: this._config.entity } )} `; @@ -116,8 +115,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { ${this.hass.localize( "ui.panel.lovelace.warning.entity_non_numeric", - "entity", - this._config.entity + { entity: this._config.entity } )} `; diff --git a/src/panels/lovelace/cards/hui-logbook-card.ts b/src/panels/lovelace/cards/hui-logbook-card.ts index 590220eb47..d73e246eb1 100644 --- a/src/panels/lovelace/cards/hui-logbook-card.ts +++ b/src/panels/lovelace/cards/hui-logbook-card.ts @@ -106,11 +106,9 @@ export class HuiLogbookCard extends LitElement implements LovelaceCard { if (!isComponentLoaded(this.hass, "logbook")) { return html` - ${this.hass.localize( - "ui.components.logbook.not_loaded", - "platform", - "logbook" - )} `; } diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index 248128ece5..55654a06cf 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -212,11 +212,9 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard { if (stateObj.state === UNAVAILABLE) { return html` - ${this.hass.localize( - "ui.panel.lovelace.warning.entity_unavailable", - "entity", - `${computeStateName(stateObj)} (${this._config.entity})` - )} + ${this.hass.localize("ui.panel.lovelace.warning.entity_unavailable", { + entity: `${computeStateName(stateObj)} (${this._config.entity})`, + })} `; } diff --git a/src/panels/lovelace/common/compute-tooltip.ts b/src/panels/lovelace/common/compute-tooltip.ts index 211129299e..b371984b44 100644 --- a/src/panels/lovelace/common/compute-tooltip.ts +++ b/src/panels/lovelace/common/compute-tooltip.ts @@ -20,45 +20,39 @@ function computeActionTooltip( return ""; } - let tooltip = - (isHold - ? hass.localize("ui.panel.lovelace.cards.picture-elements.hold") - : hass.localize("ui.panel.lovelace.cards.picture-elements.tap")) + " "; + let tooltip = isHold + ? hass.localize("ui.panel.lovelace.cards.picture-elements.hold") + : hass.localize("ui.panel.lovelace.cards.picture-elements.tap"); switch (config.action) { case "navigate": - tooltip += `${hass.localize( + tooltip += ` ${hass.localize( "ui.panel.lovelace.cards.picture-elements.navigate_to", - "location", - config.navigation_path + { location: config.navigation_path } )}`; break; case "url": - tooltip += `${hass.localize( + tooltip += ` ${hass.localize( "ui.panel.lovelace.cards.picture-elements.url", - "url_path", - config.url_path + { url_path: config.url_path } )}`; break; case "toggle": - tooltip += `${hass.localize( + tooltip += ` ${hass.localize( "ui.panel.lovelace.cards.picture-elements.toggle", - "name", - state + { name: state } )}`; break; case "call-service": tooltip += `${hass.localize( "ui.panel.lovelace.cards.picture-elements.call_service", - "name", - config.service + { name: config.service } )}`; break; case "more-info": tooltip += `${hass.localize( "ui.panel.lovelace.cards.picture-elements.more_info", - "name", - state + { name: state } )}`; break; } diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index 300a713f0b..bb3e08da62 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -555,13 +555,11 @@ export const generateDefaultViewConfig = ( title: device.name_by_user || device.name || - localize( - "ui.panel.config.devices.unnamed_device", - "type", - localize( + localize("ui.panel.config.devices.unnamed_device", { + type: localize( `ui.panel.config.devices.type.${device.entry_type || "device"}` - ) - ), + ), + }), } ) ); diff --git a/src/panels/lovelace/common/handle-action.ts b/src/panels/lovelace/common/handle-action.ts index c1995c2f81..b9b4041d5f 100644 --- a/src/panels/lovelace/common/handle-action.ts +++ b/src/panels/lovelace/common/handle-action.ts @@ -74,15 +74,14 @@ export const handleAction = async ( !(await showConfirmationDialog(node, { text: actionConfig.confirmation.text || - hass.localize( - "ui.panel.lovelace.cards.actions.action_confirmation", - "action", - serviceName || + hass.localize("ui.panel.lovelace.cards.actions.action_confirmation", { + action: + serviceName || hass.localize( `ui.panel.lovelace.editor.action-editor.actions.${actionConfig.action}` ) || - actionConfig.action - ), + actionConfig.action, + }), })) ) { return; diff --git a/src/panels/lovelace/components/hui-warning.ts b/src/panels/lovelace/components/hui-warning.ts index 20f59819c2..3a70741a47 100644 --- a/src/panels/lovelace/components/hui-warning.ts +++ b/src/panels/lovelace/components/hui-warning.ts @@ -9,11 +9,9 @@ export const createEntityNotFoundWarning = ( entityId: string ) => hass.config.state !== STATE_NOT_RUNNING - ? hass.localize( - "ui.panel.lovelace.warning.entity_not_found", - "entity", - entityId || "[empty]" - ) + ? hass.localize("ui.panel.lovelace.warning.entity_not_found", { + entity: entityId || "[empty]", + }) : hass.localize("ui.panel.lovelace.warning.starting"); @customElement("hui-warning") diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts index c25580e16f..e23cafa985 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts @@ -69,8 +69,7 @@ export class HuiCreateDialogCard const title = this._viewConfig.title ? this.hass!.localize( "ui.panel.lovelace.editor.edit_card.pick_card_view_title", - "name", - `"${this._viewConfig.title}"` + { name: `"${this._viewConfig.title}"` } ) : this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card"); diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts index bfb1193135..16078eef89 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts @@ -165,15 +165,13 @@ export class HuiDialogEditCard } heading = this.hass!.localize( "ui.panel.lovelace.editor.edit_card.typed_header", - "type", - cardName + { type: cardName } ); } else if (!this._cardConfig) { heading = this._viewConfig.title ? this.hass!.localize( "ui.panel.lovelace.editor.edit_card.pick_card_view_title", - "name", - `"${this._viewConfig.title}"` + { name: this._viewConfig.title } ) : this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card"); } else { diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts index 092dd02134..f3d25a2130 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts @@ -45,10 +45,11 @@ export class HuiCreateDialogHeaderFooter this.hass, this.hass!.localize( `ui.panel.lovelace.editor.header-footer.choose_header_footer`, - "type", - this.hass!.localize( - `ui.panel.lovelace.editor.header-footer.${this._params.type}` - ) + { + type: this.hass!.localize( + `ui.panel.lovelace.editor.header-footer.${this._params.type}` + ), + } ) )} @keydown=${this._ignoreKeydown} diff --git a/src/panels/lovelace/editor/hui-element-editor.ts b/src/panels/lovelace/editor/hui-element-editor.ts index 8a1d3d5a61..ac071cc609 100644 --- a/src/panels/lovelace/editor/hui-element-editor.ts +++ b/src/panels/lovelace/editor/hui-element-editor.ts @@ -234,11 +234,9 @@ export abstract class HuiElementEditor extends LitElement { ${this._guiSupported === false && this.configElementType ? html`
- ${this.hass.localize( - "ui.errors.config.editor_not_available", - "type", - this.configElementType - )} + ${this.hass.localize("ui.errors.config.editor_not_available", { + type: this.configElementType, + })}
` : ""} diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 46b01ad325..b4a5cd9ed0 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -138,8 +138,7 @@ export class HuiDialogEditView extends LitElement { return this.hass!.localize( "ui.panel.lovelace.editor.edit_view.header_name", - "name", - this._config.title + { name: this._config.title } ); } @@ -376,10 +375,10 @@ export class HuiDialogEditView extends LitElement { `ui.panel.lovelace.views.confirm_delete${ this._cards?.length ? "_existing_cards" : "" }_text`, - "name", - this._config?.title || "Unnamed view", - "number", - this._cards?.length || 0 + { + name: this._config?.title || "Unnamed view", + number: this._cards?.length || 0, + } ), confirm: () => this._delete(), }); diff --git a/src/panels/lovelace/elements/hui-state-label-element.ts b/src/panels/lovelace/elements/hui-state-label-element.ts index 7a210f1458..a8176fdb4a 100644 --- a/src/panels/lovelace/elements/hui-state-label-element.ts +++ b/src/panels/lovelace/elements/hui-state-label-element.ts @@ -60,10 +60,7 @@ class HuiStateLabelElement extends LitElement implements LovelaceElement { `; diff --git a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts index 5e97a25539..050209570a 100644 --- a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts @@ -53,12 +53,11 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow { ${stateObj.state === "on" ? html` ${stateObj.attributes.mode !== "single" && - (stateObj.attributes.current || 0) > 0 - ? this.hass.localize( - "ui.card.script.cancel_multiple", - "number", - stateObj.attributes.current - ) + stateObj.attributes.current && + stateObj.attributes.current > 0 + ? this.hass.localize("ui.card.script.cancel_multiple", { + number: stateObj.attributes.current, + }) : this.hass.localize("ui.card.script.cancel")} ` : ""} diff --git a/src/panels/lovelace/hui-editor.ts b/src/panels/lovelace/hui-editor.ts index f375d47847..8748cb195f 100644 --- a/src/panels/lovelace/hui-editor.ts +++ b/src/panels/lovelace/hui-editor.ts @@ -213,8 +213,7 @@ class LovelaceFullConfigEditor extends LitElement { showAlertDialog(this, { text: this.hass.localize( "ui.panel.lovelace.editor.raw_editor.error_remove", - "error", - err + { error: err } ), }); } @@ -263,8 +262,7 @@ class LovelaceFullConfigEditor extends LitElement { showAlertDialog(this, { text: this.hass.localize( "ui.panel.lovelace.editor.raw_editor.error_parse_yaml", - "error", - err + { error: err } ), }); this._saving = false; @@ -280,8 +278,7 @@ class LovelaceFullConfigEditor extends LitElement { showAlertDialog(this, { text: this.hass.localize( "ui.panel.lovelace.editor.raw_editor.error_invalid_config", - "error", - err + { error: err } ), }); return; @@ -300,8 +297,7 @@ class LovelaceFullConfigEditor extends LitElement { showAlertDialog(this, { text: this.hass.localize( "ui.panel.lovelace.editor.raw_editor.error_save_yaml", - "error", - err + { error: err } ), }); } diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index 9810837ccf..55888fe09d 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -380,23 +380,19 @@ class HaPanelMy extends LitElement { switch (this._error) { case "not_supported": error = - this.hass.localize( - "ui.panel.my.not_supported", - "link", - html`
${this.hass.localize("ui.panel.my.faq_link")}` - ) || "This redirect is not supported."; + >`, + }) || "This redirect is not supported."; break; case "no_component": error = - this.hass.localize( - "ui.panel.my.component_not_loaded", - "integration", - html`` - ) || "This redirect is not supported."; + >`, + }) || "This redirect is not supported."; break; case "no_supervisor": - error = this.hass.localize( - "ui.panel.my.no_supervisor", - "docs_link", - html`${this.hass.localize("ui.panel.my.documentation")}` - ); + >`, + }); break; case "not_app": - error = this.hass.localize( - "ui.panel.my.not_app", - "link", - html`${this.hass.localize("ui.panel.my.download_app")}` - ); + >`, + }); break; default: error = this.hass.localize("ui.panel.my.error") || "Unknown error"; diff --git a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts index 2371d44fd2..2cb2eeefe3 100644 --- a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts +++ b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts @@ -97,8 +97,7 @@ class HaMfaModuleSetupFlow extends LitElement { ? html`

${this.hass.localize( "ui.panel.profile.mfa_setup.step_done", - "step", - this._step.title + { step: this._step.title } )}

` : this._step.type === "form" diff --git a/src/panels/profile/ha-long-lived-access-token-dialog.ts b/src/panels/profile/ha-long-lived-access-token-dialog.ts index 7841e4918a..4dd9fe1298 100644 --- a/src/panels/profile/ha-long-lived-access-token-dialog.ts +++ b/src/panels/profile/ha-long-lived-access-token-dialog.ts @@ -115,8 +115,7 @@ export class HaLongLivedAccessTokenDialog extends LitElement { this._qrCode = html`${this.hass.localize(`; diff --git a/src/panels/profile/ha-long-lived-access-tokens-card.ts b/src/panels/profile/ha-long-lived-access-tokens-card.ts index c622ad0d7e..a835f98986 100644 --- a/src/panels/profile/ha-long-lived-access-tokens-card.ts +++ b/src/panels/profile/ha-long-lived-access-tokens-card.ts @@ -67,11 +67,12 @@ class HaLongLivedTokens extends LitElement {
${this.hass.localize( "ui.panel.profile.long_lived_access_tokens.created", - "date", - relativeTime( - new Date(token.created_at), - this.hass.locale - ) + { + date: relativeTime( + new Date(token.created_at), + this.hass.locale + ), + } )}
${stateObj.attributes.mode !== "single" && (stateObj.attributes.current || 0) > 0 - ? this.hass.localize( - "ui.card.script.cancel_multiple", - "number", - stateObj.attributes.current - ) + ? this.hass.localize("ui.card.script.cancel_multiple", { + number: stateObj.attributes.current, + }) : this.hass.localize("ui.card.script.cancel")} ` : ""} diff --git a/src/state/disconnect-toast-mixin.ts b/src/state/disconnect-toast-mixin.ts index f3c8059c54..3e3ad16878 100644 --- a/src/state/disconnect-toast-mixin.ts +++ b/src/state/disconnect-toast-mixin.ts @@ -144,11 +144,9 @@ export default >(superClass: T) => showToast(this, { message: - this.hass!.localize( - "ui.notification_toast.integration_starting", - "integration", - domainToName(this.hass!.localize, integration) - ) || + this.hass!.localize("ui.notification_toast.integration_starting", { + integration: domainToName(this.hass!.localize, integration), + }) || `Starting ${integration}, not everything will be available until it is finished.`, duration: 0, dismissable: false,