Use new localize format (#18574)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
pull/18789/head
Kendell R 2023-11-28 04:29:41 -08:00 committed by GitHub
parent 2087028c47
commit f4ee734ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 596 additions and 791 deletions

View File

@ -48,8 +48,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
<a target="_blank" href=${conf.authorUrl}> <a target="_blank" href=${conf.authorUrl}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.page-demo.cards.demo.demo_by", "ui.panel.page-demo.cards.demo.demo_by",
"name", { name: conf.authorName }
conf.authorName
)} )}
</a> </a>
</small> </small>

View File

@ -49,11 +49,9 @@ export class HassioAddonRepositoryEl extends LitElement {
return html` return html`
<div class="content"> <div class="content">
<p class="description"> <p class="description">
${this.supervisor.localize( ${this.supervisor.localize("store.no_results_found", {
"store.no_results_found", repository: repo.name,
"repository", })}
repo.name
)}
</p> </p>
</div> </div>
`; `;

View File

@ -340,11 +340,9 @@ class HassioAddonConfig extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_reset", {
"addon.failed_to_reset", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
button.progress = false; button.progress = false;
} }
@ -381,11 +379,9 @@ class HassioAddonConfig extends LitElement {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
eventdata.success = false; eventdata.success = false;
} }
button.progress = false; button.progress = false;

View File

@ -180,11 +180,9 @@ class HassioAddonNetwork extends LitElement {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_reset", {
"addon.failed_to_reset", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
button.actionError(); button.actionError();
} }
} }
@ -220,11 +218,9 @@ class HassioAddonNetwork extends LitElement {
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon); await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
} }
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
button.actionError(); button.actionError();
} }
} }

View File

@ -85,8 +85,7 @@ class HassioAddonDocumentationDashboard extends LitElement {
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize(
"addon.documentation.get_documentation", "addon.documentation.get_documentation",
"error", { error: extractApiErrorMessage(err) }
extractApiErrorMessage(err)
); );
} }
} }

View File

@ -451,13 +451,14 @@ class HassioAddonInfo extends LitElement {
<div class="description light-color"> <div class="description light-color">
${this.addon.description}.<br /> ${this.addon.description}.<br />
${this.supervisor.localize( ${this.supervisor.localize("addon.dashboard.visit_addon_page", {
"addon.dashboard.visit_addon_page", name: html`<a
"name", href=${this.addon.url!}
html`<a href=${this.addon.url!} target="_blank" rel="noreferrer" target="_blank"
rel="noreferrer"
>${this.addon.name}</a >${this.addon.name}</a
>` >`,
)} })}
</div> </div>
<div class="addon-container"> <div class="addon-container">
<div> <div>
@ -624,10 +625,10 @@ class HassioAddonInfo extends LitElement {
<ha-alert alert-type="warning"> <ha-alert alert-type="warning">
${this.supervisor.localize( ${this.supervisor.localize(
"addon.dashboard.not_available_version", "addon.dashboard.not_available_version",
"core_version_installed", {
this.supervisor.core.version, core_version_installed: this.supervisor.core.version,
"core_version_needed", core_version_needed: addonStoreInfo!.homeassistant,
addonStoreInfo!.homeassistant }
)} )}
</ha-alert> </ha-alert>
` `
@ -800,12 +801,11 @@ class HassioAddonInfo extends LitElement {
id === "stage" id === "stage"
? this.supervisor.localize( ? this.supervisor.localize(
`addon.dashboard.capability.${id}.description`, `addon.dashboard.capability.${id}.description`,
"icon_stable", {
`<ha-svg-icon path="${STAGE_ICON.stable}"></ha-svg-icon>`, icon_stable: `<ha-svg-icon path="${STAGE_ICON.stable}"></ha-svg-icon>`,
"icon_experimental", icon_experimental: `<ha-svg-icon path="${STAGE_ICON.experimental}"></ha-svg-icon>`,
`<ha-svg-icon path="${STAGE_ICON.experimental}"></ha-svg-icon>`, icon_deprecated: `<ha-svg-icon path="${STAGE_ICON.deprecated}"></ha-svg-icon>`,
"icon_deprecated", }
`<ha-svg-icon path="${STAGE_ICON.deprecated}"></ha-svg-icon>`
) )
: this.supervisor.localize( : this.supervisor.localize(
`addon.dashboard.capability.${id}.description` `addon.dashboard.capability.${id}.description`
@ -867,11 +867,9 @@ class HassioAddonInfo extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }
@ -889,11 +887,9 @@ class HassioAddonInfo extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }
@ -911,11 +907,9 @@ class HassioAddonInfo extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }
@ -933,11 +927,9 @@ class HassioAddonInfo extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }
@ -955,11 +947,9 @@ class HassioAddonInfo extends LitElement {
}; };
fireEvent(this, "hass-api-called", eventdata); fireEvent(this, "hass-api-called", eventdata);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.failed_to_save", {
"addon.failed_to_save", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }

View File

@ -72,11 +72,9 @@ class HassioAddonLogs extends LitElement {
try { try {
this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug); this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug);
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("addon.logs.get_logs", {
"addon.logs.get_logs", error: extractApiErrorMessage(err),
"error", });
extractApiErrorMessage(err)
);
} }
} }

View File

@ -46,11 +46,9 @@ export class HassioUpdate extends LitElement {
return html` return html`
<div class="content"> <div class="content">
<h1> <h1>
${this.supervisor.localize( ${this.supervisor.localize("common.update_available", {
"common.update_available", count: updatesAvailable,
"count", })}
updatesAvailable
)}
🎉 🎉
</h1> </h1>
<div class="card-group"> <div class="card-group">

View File

@ -145,8 +145,7 @@ export class DialogHassioNetwork
? html`<p> ? html`<p>
${this.supervisor.localize( ${this.supervisor.localize(
"dialog.network.connected_to", "dialog.network.connected_to",
"ssid", { ssid: this._interface?.wifi?.ssid }
this._interface?.wifi?.ssid
)} )}
</p>` </p>`
: ""} : ""}

View File

@ -76,17 +76,15 @@ class HassioMyRedirect extends LitElement {
const redirect = REDIRECTS[path]; const redirect = REDIRECTS[path];
if (!redirect) { if (!redirect) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("my.not_supported", {
"my.not_supported", link: html`<a
"link",
html`<a
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
href="https://my.home-assistant.io/faq.html#supported-pages" href="https://my.home-assistant.io/faq.html#supported-pages"
> >
${this.supervisor.localize("my.faq_link")} ${this.supervisor.localize("my.faq_link")}
</a>` </a>`,
); });
return; return;
} }

View File

@ -96,13 +96,11 @@ class HassioCoreInfo extends LitElement {
slot="primaryAction" slot="primaryAction"
class="warning" class="warning"
@click=${this._coreRestart} @click=${this._coreRestart}
.title=${this.supervisor.localize( .title=${this.supervisor.localize("common.restart_name", {
"common.restart_name", name: "Core",
"name", })}
"Core"
)}
> >
${this.supervisor.localize("common.restart_name", "name", "Core")} ${this.supervisor.localize("common.restart_name", { name: "Core" })}
</ha-progress-button> </ha-progress-button>
</div> </div>
</ha-card> </ha-card>
@ -122,16 +120,12 @@ class HassioCoreInfo extends LitElement {
button.progress = true; button.progress = true;
const confirmed = await showConfirmationDialog(this, { const confirmed = await showConfirmationDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize("confirm.restart.title", {
"confirm.restart.title", name: "Home Assistant Core",
"name", }),
"Home Assistant Core" text: this.supervisor.localize("confirm.restart.text", {
), name: "Home Assistant Core",
text: this.supervisor.localize( }),
"confirm.restart.text",
"name",
"Home Assistant Core"
),
confirmText: this.supervisor.localize("common.restart"), confirmText: this.supervisor.localize("common.restart"),
dismissText: this.supervisor.localize("common.cancel"), dismissText: this.supervisor.localize("common.cancel"),
}); });
@ -146,11 +140,9 @@ class HassioCoreInfo extends LitElement {
} catch (err: any) { } catch (err: any) {
if (this.hass.connection.connected) { if (this.hass.connection.connected) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize("common.failed_to_restart_name", {
"common.failed_to_restart_name", name: "Home Assistant Core",
"name", }),
"Home AssistantCore"
),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
}); });
} }

View File

@ -200,17 +200,13 @@ class HassioSupervisorInfo extends LitElement {
<ha-progress-button <ha-progress-button
class="warning" class="warning"
@click=${this._supervisorRestart} @click=${this._supervisorRestart}
.title=${this.supervisor.localize( .title=${this.supervisor.localize("common.restart_name", {
"common.restart_name", name: "Supervisor",
"name", })}
"Supervisor"
)}
> >
${this.supervisor.localize( ${this.supervisor.localize("common.restart_name", {
"common.restart_name", name: "Supervisor",
"name", })}
"Supervisor"
)}
</ha-progress-button> </ha-progress-button>
</div> </div>
</ha-card> </ha-card>
@ -292,16 +288,12 @@ class HassioSupervisorInfo extends LitElement {
button.progress = true; button.progress = true;
const confirmed = await showConfirmationDialog(this, { const confirmed = await showConfirmationDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize("confirm.restart.title", {
"confirm.restart.title", name: "Supervisor",
"name", }),
"Supervisor" text: this.supervisor.localize("confirm.restart.text", {
), name: "Supervisor",
text: this.supervisor.localize( }),
"confirm.restart.text",
"name",
"Supervisor"
),
confirmText: this.supervisor.localize("common.restart"), confirmText: this.supervisor.localize("common.restart"),
dismissText: this.supervisor.localize("common.cancel"), dismissText: this.supervisor.localize("common.cancel"),
}); });
@ -315,11 +307,9 @@ class HassioSupervisorInfo extends LitElement {
await restartSupervisor(this.hass); await restartSupervisor(this.hass);
} catch (err: any) { } catch (err: any) {
showAlertDialog(this, { showAlertDialog(this, {
title: this.supervisor.localize( title: this.supervisor.localize("common.failed_to_restart_name", {
"common.failed_to_restart_name", name: "Supervisor",
"name", }),
"Supervisor"
),
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
}); });
} finally { } finally {
@ -334,8 +324,7 @@ class HassioSupervisorInfo extends LitElement {
), ),
text: this.supervisor.localize( text: this.supervisor.localize(
"system.supervisor.share_diagonstics_description", "system.supervisor.share_diagonstics_description",
"line_break", { line_break: html`<br /><br />` }
html`<br /><br />`
), ),
}); });
} }

View File

@ -124,13 +124,10 @@ class HassioSupervisorLog extends LitElement {
this._selectedLogProvider this._selectedLogProvider
); );
} catch (err: any) { } catch (err: any) {
this._error = this.supervisor.localize( this._error = this.supervisor.localize("system.log.get_logs", {
"system.log.get_logs", provider: this._selectedLogProvider,
"provider", error: extractApiErrorMessage(err),
this._selectedLogProvider, });
"error",
extractApiErrorMessage(err)
);
} }
} }

View File

@ -181,11 +181,9 @@ export class HaAuthFlow extends LitElement {
case "error": case "error":
return html` return html`
<ha-alert alert-type="error"> <ha-alert alert-type="error">
${this.localize( ${this.localize("ui.panel.page-authorize.form.error", {
"ui.panel.page-authorize.form.error", error: this._errorMessage,
"error", })}
this._errorMessage
)}
</ha-alert> </ha-alert>
<div class="action"> <div class="action">
<mwc-button raised @click=${this._startOver}> <mwc-button raised @click=${this._startOver}>

View File

@ -1,4 +1,5 @@
import IntlMessageFormat from "intl-messageformat"; import IntlMessageFormat from "intl-messageformat";
import type { HTMLTemplateResult } from "lit";
import { polyfillLocaleData } from "../../resources/locale-data-polyfill"; import { polyfillLocaleData } from "../../resources/locale-data-polyfill";
import { Resources, TranslationDict } from "../../types"; import { Resources, TranslationDict } from "../../types";
@ -40,9 +41,13 @@ export type FlattenObjectKeys<
: `${Key}` : `${Key}`
: never; : never;
// Later, don't return string when HTML is passed, and don't allow undefined
export type LocalizeFunc<Keys extends string = LocalizeKeys> = ( export type LocalizeFunc<Keys extends string = LocalizeKeys> = (
key: Keys, key: Keys,
...args: any[] values?: Record<
string,
string | number | HTMLTemplateResult | null | undefined
>
) => string; ) => string;
interface FormatType { interface FormatType {
@ -124,6 +129,7 @@ export const computeLocalize = async <Keys extends string = LocalizeKeys>(
argObject = args[0]; argObject = args[0];
} else { } else {
for (let i = 0; i < args.length; i += 2) { 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]; argObject[args[i]] = args[i + 1];
} }
} }

View File

@ -126,8 +126,11 @@ export class HaRelatedFilterButtonMenu extends LitElement {
} }
const filter = this.hass.localize( const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_entity", "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); const items = await findRelated(this.hass, "entity", entityId);
fireEvent(this, "related-changed", { fireEvent(this, "related-changed", {
@ -146,11 +149,12 @@ export class HaRelatedFilterButtonMenu extends LitElement {
} }
const filter = this.hass.localize( const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_device", "ui.components.related-filter-menu.filtered_by_device",
"device_name", {
computeDeviceName( device_name: computeDeviceName(
(ev.currentTarget as any).comboBox.selectedItem, (ev.currentTarget as any).comboBox.selectedItem,
this.hass this.hass
) ),
}
); );
const items = await findRelated(this.hass, "device", deviceId); const items = await findRelated(this.hass, "device", deviceId);
@ -170,8 +174,7 @@ export class HaRelatedFilterButtonMenu extends LitElement {
} }
const filter = this.hass.localize( const filter = this.hass.localize(
"ui.components.related-filter-menu.filtered_by_area", "ui.components.related-filter-menu.filtered_by_area",
"area_name", { area_name: (ev.currentTarget as any).comboBox.selectedItem.name }
(ev.currentTarget as any).comboBox.selectedItem.name
); );
const items = await findRelated(this.hass, "area", areaId); const items = await findRelated(this.hass, "area", areaId);
fireEvent(this, "related-changed", { fireEvent(this, "related-changed", {

View File

@ -64,7 +64,7 @@ export class HaFileUpload extends LitElement {
>${this.value >${this.value
? this.hass?.localize( ? this.hass?.localize(
"ui.components.file-upload.uploading_name", "ui.components.file-upload.uploading_name",
{ name: this.value } { name: this.value.toString() }
) )
: this.hass?.localize( : this.hass?.localize(
"ui.components.file-upload.uploading" "ui.components.file-upload.uploading"

View File

@ -800,10 +800,8 @@ export class HaMediaPlayerBrowse extends LitElement {
<p> <p>
${this.hass.localize("ui.components.media-browser.no_media_folder")} ${this.hass.localize("ui.components.media-browser.no_media_folder")}
<br /> <br />
${this.hass.localize( ${this.hass.localize("ui.components.media-browser.setup_local_help", {
"ui.components.media-browser.setup_local_help", documentation: html`<a
"documentation",
html`<a
href=${documentationUrl( href=${documentationUrl(
this.hass, this.hass,
"/more-info/local-media/setup-media" "/more-info/local-media/setup-media"
@ -813,8 +811,8 @@ export class HaMediaPlayerBrowse extends LitElement {
>${this.hass.localize( >${this.hass.localize(
"ui.components.media-browser.documentation" "ui.components.media-browser.documentation"
)}</a )}</a
>` >`,
)} })}
<br /> <br />
${this.hass.localize("ui.components.media-browser.local_media_files")} ${this.hass.localize("ui.components.media-browser.local_media_files")}
</p> </p>

View File

@ -1,7 +1,7 @@
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
export interface ApplicationCredentialsDomainConfig { export interface ApplicationCredentialsDomainConfig {
description_placeholders: string; description_placeholders: Record<string, string>;
} }
export interface ApplicationCredentialsConfig { export interface ApplicationCredentialsConfig {

View File

@ -374,7 +374,7 @@ const tryDescribeTrigger = (
trigger.event === "sunset" trigger.event === "sunset"
? `${triggerTranslationBaseKey}.sun.description.sets` ? `${triggerTranslationBaseKey}.sun.description.sets`
: `${triggerTranslationBaseKey}.sun.description.rises`, : `${triggerTranslationBaseKey}.sun.description.rises`,
{ hasDuration: duration !== "", duration: duration } { hasDuration: duration !== "" ? "true" : "false", duration: duration }
); );
} }
@ -604,7 +604,7 @@ const tryDescribeTrigger = (
return hass.localize( return hass.localize(
`${triggerTranslationBaseKey}.template.description.full`, `${triggerTranslationBaseKey}.template.description.full`,
{ hasDuration: duration !== "", duration: duration } { hasDuration: duration !== "" ? "true" : "false", duration: duration }
); );
} }
@ -959,8 +959,8 @@ const tryDescribeCondition = (
`${conditionsTranslationBaseKey}.time.description.full`, `${conditionsTranslationBaseKey}.time.description.full`,
{ {
hasTime: hasTime, hasTime: hasTime,
hasTimeAndDay: (after || before) && validWeekdays, hasTimeAndDay: (after || before) && validWeekdays ? "true" : "false",
hasDay: validWeekdays, hasDay: validWeekdays ? "true" : "false",
time_before: before, time_before: before,
time_after: after, time_after: after,
day: formatListWithOrs(hass.locale, localizedDays), day: formatListWithOrs(hass.locale, localizedDays),

View File

@ -201,14 +201,14 @@ export const localizeDeviceAutomationAction = (
): string => ): string =>
hass.localize( hass.localize(
`component.${action.domain}.device_automation.action_type.${action.type}`, `component.${action.domain}.device_automation.action_type.${action.type}`,
"entity_name", {
getEntityName(hass, entityRegistry, action.entity_id), entity_name: getEntityName(hass, entityRegistry, action.entity_id),
"subtype", subtype: action.subtype
action.subtype
? hass.localize( ? hass.localize(
`component.${action.domain}.device_automation.action_subtype.${action.subtype}` `component.${action.domain}.device_automation.action_subtype.${action.subtype}`
) || action.subtype ) || action.subtype
: "" : "",
}
) || (action.subtype ? `"${action.subtype}" ${action.type}` : action.type!); ) || (action.subtype ? `"${action.subtype}" ${action.type}` : action.type!);
export const localizeDeviceAutomationCondition = ( export const localizeDeviceAutomationCondition = (
@ -218,14 +218,14 @@ export const localizeDeviceAutomationCondition = (
): string => ): string =>
hass.localize( hass.localize(
`component.${condition.domain}.device_automation.condition_type.${condition.type}`, `component.${condition.domain}.device_automation.condition_type.${condition.type}`,
"entity_name", {
getEntityName(hass, entityRegistry, condition.entity_id), entity_name: getEntityName(hass, entityRegistry, condition.entity_id),
"subtype", subtype: condition.subtype
condition.subtype
? hass.localize( ? hass.localize(
`component.${condition.domain}.device_automation.condition_subtype.${condition.subtype}` `component.${condition.domain}.device_automation.condition_subtype.${condition.subtype}`
) || condition.subtype ) || condition.subtype
: "" : "",
}
) || ) ||
(condition.subtype (condition.subtype
? `"${condition.subtype}" ${condition.type}` ? `"${condition.subtype}" ${condition.type}`
@ -238,14 +238,14 @@ export const localizeDeviceAutomationTrigger = (
): string => ): string =>
hass.localize( hass.localize(
`component.${trigger.domain}.device_automation.trigger_type.${trigger.type}`, `component.${trigger.domain}.device_automation.trigger_type.${trigger.type}`,
"entity_name", {
getEntityName(hass, entityRegistry, trigger.entity_id), entity_name: getEntityName(hass, entityRegistry, trigger.entity_id),
"subtype", subtype: trigger.subtype
trigger.subtype
? hass.localize( ? hass.localize(
`component.${trigger.domain}.device_automation.trigger_subtype.${trigger.subtype}` `component.${trigger.domain}.device_automation.trigger_subtype.${trigger.subtype}`
) || trigger.subtype ) || trigger.subtype
: "" : "",
}
) || ) ||
(trigger.subtype ? `"${trigger.subtype}" ${trigger.type}` : trigger.type!); (trigger.subtype ? `"${trigger.subtype}" ${trigger.type}` : trigger.type!);

View File

@ -65,13 +65,11 @@ export const computeDeviceName = (
device.name_by_user || device.name_by_user ||
device.name || device.name ||
(entities && fallbackDeviceName(hass, entities)) || (entities && fallbackDeviceName(hass, entities)) ||
hass.localize( hass.localize("ui.panel.config.devices.unnamed_device", {
"ui.panel.config.devices.unnamed_device", type: hass.localize(
"type",
hass.localize(
`ui.panel.config.devices.type.${device.entry_type || "device"}` `ui.panel.config.devices.type.${device.entry_type || "device"}`
) ),
); });
export const devicesInArea = (devices: DeviceRegistryEntry[], areaId: string) => export const devicesInArea = (devices: DeviceRegistryEntry[], areaId: string) =>
devices.filter((device) => device.area_id === areaId); devices.filter((device) => device.area_id === areaId);

View File

@ -194,7 +194,7 @@ export const localizeStateMessage = (
if (state === "home") { if (state === "home") {
return localize(`${LOGBOOK_LOCALIZE_PATH}.was_at_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": case "sun":
return state === "above_horizon" return state === "above_horizon"
@ -382,11 +382,9 @@ export const localizeStateMessage = (
return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unavailable`); return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unavailable`);
} }
return hass.localize( return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.changed_to_state`, {
`${LOGBOOK_LOCALIZE_PATH}.changed_to_state`, state: stateObj ? hass.formatEntityState(stateObj, state) : state,
"state", });
stateObj ? hass.formatEntityState(stateObj, state) : state
);
}; };
export const filterLogbookCompatibleEntities: HaEntityPickerEntityFilterFunc = ( export const filterLogbookCompatibleEntities: HaEntityPickerEntityFilterFunc = (

View File

@ -259,9 +259,15 @@ const tryDescribeAction = <T extends ActionType>(
return hass.localize( return hass.localize(
`${actionTranslationBaseKey}.play_media.description.full`, `${actionTranslationBaseKey}.play_media.description.full`,
{ {
hasMedia: config.metadata.title || config.data.media_content_id, hasMedia:
media: config.metadata.title || config.data.media_content_id, config.metadata.title || config.data.media_content_id
hasMediaPlayer: mediaStateObj ? true : entityId !== undefined, ? "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, mediaPlayer: mediaStateObj ? computeStateName(mediaStateObj) : entityId,
} }
); );
@ -317,7 +323,7 @@ const tryDescribeAction = <T extends ActionType>(
if (actionType === "stop") { if (actionType === "stop") {
const config = action as StopAction; const config = action as StopAction;
return hass.localize(`${actionTranslationBaseKey}.stop.description.full`, { return hass.localize(`${actionTranslationBaseKey}.stop.description.full`, {
hasReason: config.stop !== undefined, hasReason: config.stop !== undefined ? "true" : "false",
reason: config.stop, reason: config.stop,
}); });
} }

View File

@ -177,10 +177,10 @@ export const computeUpdateStateDisplay = (
if (updateIsInstalling(stateObj)) { if (updateIsInstalling(stateObj)) {
const supportsProgress = const supportsProgress =
supportsFeature(stateObj, UPDATE_SUPPORT_PROGRESS) && supportsFeature(stateObj, UPDATE_SUPPORT_PROGRESS) &&
typeof typeof attributes.in_progress === "number"; typeof attributes.in_progress === "number";
if (supportsProgress) { if (supportsProgress) {
return hass.localize("ui.card.update.installing_with_progress", { 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"); return hass.localize("ui.card.update.installing");

View File

@ -56,9 +56,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
@closed=${this.closeDialog} @closed=${this.closeDialog}
.heading=${this.hass.localize( .heading=${this.hass.localize(
"ui.dialogs.config_entry_system_options.title", "ui.dialogs.config_entry_system_options.title",
"integration", {
this.hass.localize(`component.${this._params.entry.domain}.title`) || integration:
this._params.entry.domain this.hass.localize(
`component.${this._params.entry.domain}.title`
) || this._params.entry.domain,
}
)} )}
> >
${this._error ? html` <div class="error">${this._error}</div> ` : ""} ${this._error ? html` <div class="error">${this._error}</div> ` : ""}
@ -71,10 +74,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
<p class="secondary"> <p class="secondary">
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.config_entry_system_options.enable_new_entities_description", "ui.dialogs.config_entry_system_options.enable_new_entities_description",
"integration", {
integration:
this.hass.localize( this.hass.localize(
`component.${this._params.entry.domain}.title` `component.${this._params.entry.domain}.title`
) || this._params.entry.domain ) || this._params.entry.domain,
}
)} )}
</p>`} </p>`}
.dir=${computeRTLDirection(this.hass)} .dir=${computeRTLDirection(this.hass)}
@ -96,10 +101,12 @@ class DialogConfigEntrySystemOptions extends LitElement {
<p class="secondary"> <p class="secondary">
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.config_entry_system_options.enable_polling_description", "ui.dialogs.config_entry_system_options.enable_polling_description",
"integration", {
integration:
this.hass.localize( this.hass.localize(
`component.${this._params.entry.domain}.title` `component.${this._params.entry.domain}.title`
) || this._params.entry.domain ) || this._params.entry.domain,
}
)} )}
</p>`} </p>`}
.dir=${computeRTLDirection(this.hass)} .dir=${computeRTLDirection(this.hass)}

View File

@ -174,8 +174,7 @@ export const showConfigFlowDialog = (
<p> <p>
${hass.localize( ${hass.localize(
"ui.panel.config.integrations.config_flow.created_config", "ui.panel.config.integrations.config_flow.created_config",
"name", { name: step.title }
step.title
)} )}
</p> </p>
`; `;

View File

@ -98,8 +98,7 @@ class StepFlowCreateEntry extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.integrations.config_flow.error_saving_area", "ui.panel.config.integrations.config_flow.error_saving_area",
"error", { error: err.message }
err.message
), ),
}); });
picker.value = null; picker.value = null;

View File

@ -25,11 +25,9 @@ export class HuiConfiguratorNotificationItem extends LitElement {
</span> </span>
<div> <div>
${this.hass.localize( ${this.hass.localize("ui.notification_drawer.click_to_configure", {
"ui.notification_drawer.click_to_configure", entity: this.notification.attributes.friendly_name,
"entity", })}
this.notification.attributes.friendly_name
)}
</div> </div>
<mwc-button slot="actions" @click=${this._handleClick}> <mwc-button slot="actions" @click=${this._handleClick}>

View File

@ -523,11 +523,9 @@ export class QuickBar extends LitElement {
const commands = reloadableDomains.map((domain) => ({ const commands = reloadableDomains.map((domain) => ({
primaryText: primaryText:
this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) || this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) ||
this.hass.localize( this.hass.localize("ui.dialogs.quick-bar.commands.reload.reload", {
"ui.dialogs.quick-bar.commands.reload.reload", domain: domainToName(localize, domain),
"domain", }),
domainToName(localize, domain)
),
action: () => this.hass.callService(domain, "reload"), action: () => this.hass.callService(domain, "reload"),
iconPath: mdiReload, iconPath: mdiReload,
categoryText: this.hass.localize( categoryText: this.hass.localize(
@ -588,10 +586,11 @@ export class QuickBar extends LitElement {
const item = { const item = {
primaryText: this.hass.localize( primaryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.server_control.perform_action", "ui.dialogs.quick-bar.commands.server_control.perform_action",
"action", {
this.hass.localize( action: this.hass.localize(
`ui.dialogs.quick-bar.commands.server_control.${action}` `ui.dialogs.quick-bar.commands.server_control.${action}`
) ),
}
), ),
iconPath: mdiServerNetwork, iconPath: mdiServerNetwork,
categoryText: this.hass.localize( categoryText: this.hass.localize(

View File

@ -147,11 +147,9 @@ export class HaTabsSubpageDataTable extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
const hiddenLabel = this.numHidden const hiddenLabel = this.numHidden
? this.hiddenLabel || ? this.hiddenLabel ||
this.hass.localize( this.hass.localize("ui.components.data-table.hidden", {
"ui.components.data-table.hidden", number: this.numHidden,
"number", }) ||
this.numHidden
) ||
this.numHidden this.numHidden
: undefined; : undefined;

View File

@ -120,8 +120,7 @@ export class HaConfigApplicationCredentials extends LitElement {
<p class="selected-txt"> <p class="selected-txt">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.application_credentials.picker.selected", "ui.panel.config.application_credentials.picker.selected",
"number", { number: this._selected.length }
this._selected.length
)} )}
</p> </p>
<div class="header-btns"> <div class="header-btns">
@ -178,8 +177,7 @@ export class HaConfigApplicationCredentials extends LitElement {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
`ui.panel.config.application_credentials.picker.remove_selected.confirm_title`, `ui.panel.config.application_credentials.picker.remove_selected.confirm_title`,
"number", { number: this._selected.length }
this._selected.length
), ),
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.application_credentials.picker.remove_selected.confirm_text" "ui.panel.config.application_credentials.picker.remove_selected.confirm_text"

View File

@ -1,9 +1,10 @@
import { mdiHelpCircle, mdiPlus } from "@mdi/js"; import { mdiHelpCircle, mdiPlus } from "@mdi/js";
import { UnsubscribeFunc } from "home-assistant-js-websocket"; 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 { customElement, property, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map"; import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { formatListWithAnds } from "../../../common/string/format-list";
import "../../../components/ha-fab"; import "../../../components/ha-fab";
import "../../../components/ha-icon-button"; import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon"; import "../../../components/ha-svg-icon";
@ -135,36 +136,26 @@ export class HaConfigAreasDashboard extends SubscribeMixin(LitElement) {
<h1 class="card-header">${area.name}</h1> <h1 class="card-header">${area.name}</h1>
<div class="card-content"> <div class="card-content">
<div> <div>
${area.devices ${formatListWithAnds(
? html` this.hass.locale,
${this.hass.localize( [
area.devices &&
this.hass.localize(
"ui.panel.config.integrations.config_entry.devices", "ui.panel.config.integrations.config_entry.devices",
"count", { count: area.devices }
area.devices ),
)}${area.services ? "," : ""} area.services &&
` this.hass.localize(
: ""}
${area.services
? html`
${this.hass.localize(
"ui.panel.config.integrations.config_entry.services", "ui.panel.config.integrations.config_entry.services",
"count", { count: area.services }
area.services ),
)} area.entities &&
` this.hass.localize(
: ""}
${(area.devices || area.services) && area.entities
? this.hass.localize("ui.common.and")
: ""}
${area.entities
? html`
${this.hass.localize(
"ui.panel.config.integrations.config_entry.entities", "ui.panel.config.integrations.config_entry.entities",
"count", { count: area.entities }
area.entities ),
].filter((v): v is string => Boolean(v))
)} )}
`
: ""}
</div> </div>
</div> </div>
</ha-card></a </ha-card></a

View File

@ -90,8 +90,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
if (conditions.length > 1) { if (conditions.length > 1) {
str += this.hass.localize( str += this.hass.localize(
"ui.panel.config.automation.editor.actions.type.choose.option_description_additional", "ui.panel.config.automation.editor.actions.type.choose.option_description_additional",
"numberOfAdditionalConditions", { numberOfAdditionalConditions: conditions.length - 1 }
conditions.length - 1
); );
} }
return str; return str;
@ -115,8 +114,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
<h3 slot="header"> <h3 slot="header">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.actions.type.choose.option", "ui.panel.config.automation.editor.actions.type.choose.option",
"number", { number: idx + 1 }
idx + 1
)}: )}:
${option.alias || ${option.alias ||
(this._expandedStates[idx] (this._expandedStates[idx]

View File

@ -49,8 +49,7 @@ export default class HaAutomationConditionEditor extends LitElement {
? html` ? html`
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.conditions.unsupported_condition", "ui.panel.config.automation.editor.conditions.unsupported_condition",
"condition", { condition: condition.condition }
condition.condition
)} )}
` `
: ""} : ""}

View File

@ -549,8 +549,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.automation.editor.load_error_unknown", "ui.panel.config.automation.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
history.back(); history.back();

View File

@ -352,10 +352,12 @@ class HaAutomationPicker extends LitElement {
this._activeFilters = [ this._activeFilters = [
this.hass.localize( this.hass.localize(
"ui.panel.config.automation.picker.filtered_by_blueprint", "ui.panel.config.automation.picker.filtered_by_blueprint",
"name", {
name:
!blueprintMeta || "error" in blueprintMeta !blueprintMeta || "error" in blueprintMeta
? blueprint ? blueprint
: blueprintMeta.metadata.name || blueprint : blueprintMeta.metadata.name || blueprint,
}
), ),
]; ];
} }
@ -431,8 +433,7 @@ class HaAutomationPicker extends LitElement {
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.automation.editor.load_error_unknown", "ui.panel.config.automation.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
} }
@ -457,8 +458,7 @@ class HaAutomationPicker extends LitElement {
await showAlertDialog(this, { await showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.automation.editor.load_error_unknown", "ui.panel.config.automation.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
} }

View File

@ -322,8 +322,7 @@ export default class HaAutomationTriggerRow extends LitElement {
? html` ? html`
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.triggers.unsupported_platform", "ui.panel.config.automation.editor.triggers.unsupported_platform",
"platform", { platform: this.trigger.platform }
this.trigger.platform
)} )}
` `
: ""} : ""}

View File

@ -68,10 +68,10 @@ class DialogImportBlueprint extends LitElement {
${this._result ${this._result
? html`${this.hass.localize( ? html`${this.hass.localize(
"ui.panel.config.blueprint.add.import_header", "ui.panel.config.blueprint.add.import_header",
"name", {
html`<b>${this._result.blueprint.metadata.name}</b>`, name: html`<b>${this._result.blueprint.metadata.name}</b>`,
"domain", domain: this._result.blueprint.metadata.domain,
this._result.blueprint.metadata.domain }
)} )}
<br /> <br />
<ha-markdown <ha-markdown

View File

@ -49,11 +49,9 @@ export class CloudTTSPref extends LitElement {
header=${this.hass.localize("ui.panel.config.cloud.account.tts.title")} header=${this.hass.localize("ui.panel.config.cloud.account.tts.title")}
> >
<div class="card-content"> <div class="card-content">
${this.hass.localize( ${this.hass.localize("ui.panel.config.cloud.account.tts.info", {
"ui.panel.config.cloud.account.tts.info", service: '"tts.cloud_say"',
"service", })}
'"tts.cloud_say"'
)}
<br /><br /> <br /><br />
<div class="row"> <div class="row">
<ha-language-picker <ha-language-picker

View File

@ -78,8 +78,7 @@ export class DialogTryTts extends LitElement {
.value=${this._message || .value=${this._message ||
this.hass.localize( this.hass.localize(
"ui.panel.config.cloud.account.tts.dialog.example_message", "ui.panel.config.cloud.account.tts.dialog.example_message",
"name", { name: this.hass.user!.name }
this.hass.user!.name
)} )}
> >
</ha-textarea> </ha-textarea>

View File

@ -55,14 +55,12 @@ class HaConfigSystemNavigation extends LitElement {
switch (page.translationKey) { switch (page.translationKey) {
case "backup": case "backup":
description = this._latestBackupDate description = this._latestBackupDate
? this.hass.localize( ? this.hass.localize("ui.panel.config.backup.description", {
"ui.panel.config.backup.description", relative_time: relativeTime(
"relative_time",
relativeTime(
new Date(this._latestBackupDate), new Date(this._latestBackupDate),
this.hass.locale this.hass.locale
) ),
) })
: this.hass.localize( : this.hass.localize(
"ui.panel.config.backup.description_no_backup" "ui.panel.config.backup.description_no_backup"
); );
@ -70,23 +68,21 @@ class HaConfigSystemNavigation extends LitElement {
case "network": case "network":
description = this.hass.localize( description = this.hass.localize(
"ui.panel.config.network.description", "ui.panel.config.network.description",
"state", {
this._externalAccess state: this._externalAccess
? this.hass.localize("ui.panel.config.network.enabled") ? this.hass.localize("ui.panel.config.network.enabled")
: this.hass.localize("ui.panel.config.network.disabled") : this.hass.localize("ui.panel.config.network.disabled"),
}
); );
break; break;
case "storage": case "storage":
description = this._storageInfo description = this._storageInfo
? this.hass.localize( ? this.hass.localize("ui.panel.config.storage.description", {
"ui.panel.config.storage.description", percent_used: `${Math.round(
"percent_used",
`${Math.round(
(this._storageInfo.used / this._storageInfo.total) * 100 (this._storageInfo.used / this._storageInfo.total) * 100
)}${blankBeforePercent(this.hass.locale)}%`, )}${blankBeforePercent(this.hass.locale)}%`,
"free_space", free_space: `${this._storageInfo.free} GB`,
`${this._storageInfo.free} GB` })
)
: ""; : "";
break; break;
case "hardware": case "hardware":

View File

@ -56,46 +56,40 @@ const randomTip = (hass: HomeAssistant, narrow: boolean) => {
const weighted: string[] = []; const weighted: string[] = [];
let tips = [ let tips = [
{ {
content: hass.localize( content: hass.localize("ui.panel.config.tips.join", {
"ui.panel.config.tips.join", forums: html`<a
"forums",
html`<a
href="https://community.home-assistant.io" href="https://community.home-assistant.io"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>Forums</a >Forums</a
>`, >`,
"twitter", twitter: html`<a
html`<a
href=${documentationUrl(hass, `/twitter`)} href=${documentationUrl(hass, `/twitter`)}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>Twitter</a >Twitter</a
>`, >`,
"discord", discord: html`<a
html`<a
href=${documentationUrl(hass, `/join-chat`)} href=${documentationUrl(hass, `/join-chat`)}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>Chat</a >Chat</a
>`, >`,
"blog", blog: html`<a
html`<a
href=${documentationUrl(hass, `/blog`)} href=${documentationUrl(hass, `/blog`)}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>Blog</a >Blog</a
>`, >`,
"newsletter", newsletter: html`<span class="keep-together"
html`<span class="keep-together"
><a ><a
href=${documentationUrl(hass, `/newsletter`)} href=${documentationUrl(hass, `/newsletter`)}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>Newsletter</a >Newsletter</a
> >
</span>` </span>`,
), }),
weight: 2, weight: 2,
narrow: true, narrow: true,
}, },

View File

@ -103,8 +103,7 @@ export class HaDeviceEntitiesCard extends LitElement {
<button class="show-more" @click=${this._toggleShowHidden}> <button class="show-more" @click=${this._toggleShowHidden}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.devices.entities.hidden_entities", "ui.panel.config.devices.entities.hidden_entities",
"count", { count: hiddenEntities.length }
hiddenEntities.length
)} )}
</button> </button>
` `

View File

@ -27,15 +27,13 @@ export class HaDeviceCard extends LitElement {
return html` return html`
<ha-card <ha-card
outlined outlined
.header=${this.hass.localize( .header=${this.hass.localize("ui.panel.config.devices.device_info", {
"ui.panel.config.devices.device_info", type: this.hass.localize(
"type",
this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
this.device.entry_type || "device" this.device.entry_type || "device"
}_heading` }_heading`
) ),
)} })}
> >
<div class="card-content"> <div class="card-content">
${this.device.model ${this.device.model
@ -46,8 +44,7 @@ export class HaDeviceCard extends LitElement {
<div class="manuf"> <div class="manuf">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.manuf", "ui.panel.config.integrations.config_entry.manuf",
"manufacturer", { manufacturer: this.device.manufacturer }
this.device.manufacturer
)} )}
</div> </div>
` `
@ -80,8 +77,7 @@ export class HaDeviceCard extends LitElement {
? "version" ? "version"
: "firmware" : "firmware"
}`, }`,
"version", { version: this.device.sw_version }
this.device.sw_version
)} )}
</div> </div>
` `
@ -91,8 +87,7 @@ export class HaDeviceCard extends LitElement {
<div class="extra-info"> <div class="extra-info">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.hardware", "ui.panel.config.integrations.config_entry.hardware",
"version", { version: this.device.hw_version }
this.device.hw_version
)} )}
</div> </div>
` `

View File

@ -69,8 +69,7 @@ export class HaDeviceViaDevicesCard extends LitElement {
<button class="show-more" @click=${this._toggleShowAll}> <button class="show-more" @click=${this._toggleShowAll}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.devices.connected_devices.show_more", "ui.panel.config.devices.connected_devices.show_more",
"count", { count: viaDevices.length - MAX_VISIBLE_VIA_DEVICES }
viaDevices.length - MAX_VISIBLE_VIA_DEVICES
)} )}
</button> </button>
` `

View File

@ -59,8 +59,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
@closed=${this._close} @closed=${this._close}
.heading=${this.hass!.localize( .heading=${this.hass!.localize(
"ui.dialogs.mqtt_device_debug_info.title", "ui.dialogs.mqtt_device_debug_info.title",
"device", { device: computeDeviceName(this._params.device, this.hass) }
computeDeviceName(this._params.device, this.hass)
)} )}
> >
<h4> <h4>
@ -179,8 +178,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
.subscribedTopic=${topic.topic} .subscribedTopic=${topic.topic}
.summary=${this.hass!.localize( .summary=${this.hass!.localize(
"ui.dialogs.mqtt_device_debug_info.recent_messages", "ui.dialogs.mqtt_device_debug_info.recent_messages",
"n", { n: topic.messages.length }
topic.messages.length
)} )}
> >
</mqtt-rx-messages> </mqtt-rx-messages>
@ -203,8 +201,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
.subscribedTopic=${topic.topic} .subscribedTopic=${topic.topic}
.summary=${this.hass!.localize( .summary=${this.hass!.localize(
"ui.dialogs.mqtt_device_debug_info.recent_tx_messages", "ui.dialogs.mqtt_device_debug_info.recent_tx_messages",
"n", { n: topic.messages.length }
topic.messages.length
)} )}
> >
</mqtt-tx-messages> </mqtt-tx-messages>

View File

@ -127,8 +127,7 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) {
${this._node.zwave_plus_version ${this._node.zwave_plus_version
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.zwave_js.device_info.zwave_plus_version", "ui.panel.config.zwave_js.device_info.zwave_plus_version",
"version", { version: this._node.zwave_plus_version }
this._node.zwave_plus_version
) )
: this.hass.localize("ui.common.no")} : this.hass.localize("ui.common.no")}
</div> </div>

View File

@ -90,28 +90,29 @@ class DialogDeviceRegistryDetail extends LitElement {
<div> <div>
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.device-registry-detail.enabled_label", "ui.dialogs.device-registry-detail.enabled_label",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.dialogs.device-registry-detail.type.${ `ui.dialogs.device-registry-detail.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
)} )}
</div> </div>
<div class="secondary"> <div class="secondary">
${this._disabledBy && this._disabledBy !== "user" ${this._disabledBy && this._disabledBy !== "user"
? this.hass.localize( ? this.hass.localize(
"ui.dialogs.device-registry-detail.enabled_cause", "ui.dialogs.device-registry-detail.enabled_cause",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.dialogs.device-registry-detail.type.${ `ui.dialogs.device-registry-detail.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
), ),
"cause", cause: this.hass.localize(
this.hass.localize(
`config_entry.disabled_by.${this._disabledBy}` `config_entry.disabled_by.${this._disabledBy}`
) ),
}
) )
: ""} : ""}
${this.hass.localize( ${this.hass.localize(

View File

@ -387,17 +387,14 @@ export class HaConfigDevicePage extends LitElement {
if (device.disabled_by) { if (device.disabled_by) {
deviceInfo.push(html` deviceInfo.push(html`
<ha-alert alert-type="warning"> <ha-alert alert-type="warning">
${this.hass.localize( ${this.hass.localize("ui.panel.config.devices.enabled_cause", {
"ui.panel.config.devices.enabled_cause", type: this.hass.localize(
"type",
this.hass.localize(
`ui.panel.config.devices.type.${device.entry_type || "device"}` `ui.panel.config.devices.type.${device.entry_type || "device"}`
), ),
"cause", cause: this.hass.localize(
this.hass.localize(
`ui.panel.config.devices.disabled_by.${device.disabled_by}` `ui.panel.config.devices.disabled_by.${device.disabled_by}`
) ),
)} })}
</ha-alert> </ha-alert>
${device.disabled_by === "user" ${device.disabled_by === "user"
? html` ? html`
@ -426,12 +423,13 @@ export class HaConfigDevicePage extends LitElement {
.label=${device.disabled_by .label=${device.disabled_by
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.devices.automation.create_disable", "ui.panel.config.devices.automation.create_disable",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.devices.automation.create", "ui.panel.config.devices.automation.create",
@ -486,19 +484,16 @@ export class HaConfigDevicePage extends LitElement {
` `
: html` : html`
<div class="card-content"> <div class="card-content">
${this.hass.localize( ${this.hass.localize("ui.panel.config.devices.add_prompt", {
"ui.panel.config.devices.add_prompt", name: this.hass.localize(
"name",
this.hass.localize(
"ui.panel.config.devices.automation.automations" "ui.panel.config.devices.automation.automations"
), ),
"type", type: this.hass.localize(
this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
)} })}
</div> </div>
`} `}
</ha-card> </ha-card>
@ -520,21 +515,23 @@ export class HaConfigDevicePage extends LitElement {
.label=${device.disabled_by .label=${device.disabled_by
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.devices.scene.create_disable", "ui.panel.config.devices.scene.create_disable",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.devices.scene.create", "ui.panel.config.devices.scene.create",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
)} )}
.path=${mdiPlusCircle} .path=${mdiPlusCircle}
></ha-icon-button> ></ha-icon-button>
@ -583,16 +580,16 @@ export class HaConfigDevicePage extends LitElement {
<div class="card-content"> <div class="card-content">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.devices.add_prompt", "ui.panel.config.devices.add_prompt",
"name", {
this.hass.localize( name: this.hass.localize(
"ui.panel.config.devices.scene.scenes" "ui.panel.config.devices.scene.scenes"
), ),
"type", type: this.hass.localize(
this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
)} )}
</div> </div>
`} `}
@ -613,21 +610,23 @@ export class HaConfigDevicePage extends LitElement {
.label=${device.disabled_by .label=${device.disabled_by
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.devices.script.create_disable", "ui.panel.config.devices.script.create_disable",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.devices.script.create", "ui.panel.config.devices.script.create",
"type", {
this.hass.localize( type: this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
}
)} )}
.path=${mdiPlusCircle} .path=${mdiPlusCircle}
></ha-icon-button> ></ha-icon-button>
@ -661,19 +660,16 @@ export class HaConfigDevicePage extends LitElement {
` `
: html` : html`
<div class="card-content"> <div class="card-content">
${this.hass.localize( ${this.hass.localize("ui.panel.config.devices.add_prompt", {
"ui.panel.config.devices.add_prompt", name: this.hass.localize(
"name",
this.hass.localize(
"ui.panel.config.devices.script.scripts" "ui.panel.config.devices.script.scripts"
), ),
"type", type: this.hass.localize(
this.hass.localize(
`ui.panel.config.devices.type.${ `ui.panel.config.devices.type.${
device.entry_type || "device" device.entry_type || "device"
}` }`
) ),
)} })}
</div> </div>
`} `}
</ha-card> </ha-card>
@ -703,8 +699,7 @@ export class HaConfigDevicePage extends LitElement {
<a href="/config/areas/area/${area.area_id}" <a href="/config/areas/area/${area.area_id}"
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.integrations.config_entry.area", "ui.panel.config.integrations.config_entry.area",
"area", { area: area.name || "Unnamed Area" }
area.name || "Unnamed Area"
)}</a )}</a
> >
</div>` </div>`
@ -1265,8 +1260,7 @@ export class HaConfigDevicePage extends LitElement {
(await showConfirmationDialog(this, { (await showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.devices.confirm_disable_config_entry", "ui.panel.config.devices.confirm_disable_config_entry",
"entry_name", { entry_name: config_entry.title }
config_entry.title
), ),
confirmText: this.hass.localize("ui.common.yes"), confirmText: this.hass.localize("ui.common.yes"),
dismissText: this.hass.localize("ui.common.no"), dismissText: this.hass.localize("ui.common.no"),

View File

@ -469,8 +469,7 @@ export class HaConfigDeviceDashboard extends LitElement {
)} )}
.hiddenLabel=${this.hass.localize( .hiddenLabel=${this.hass.localize(
"ui.panel.config.devices.picker.filter.hidden_devices", "ui.panel.config.devices.picker.filter.hidden_devices",
"number", { number: this._numHiddenDevices }
this._numHiddenDevices
)} )}
.columns=${this._columns( .columns=${this._columns(
this.hass.localize, this.hass.localize,

View File

@ -82,8 +82,7 @@ export class EntityRegistrySettingsHelper extends LitElement {
${!this._componentLoaded ${!this._componentLoaded
? this.hass.localize( ? this.hass.localize(
"ui.dialogs.helper_settings.platform_not_loaded", "ui.dialogs.helper_settings.platform_not_loaded",
"platform", { platform: this.entry.platform }
this.entry.platform
) )
: this._item === null : this._item === null
? this.hass.localize("ui.dialogs.helper_settings.yaml_not_editable") ? this.hass.localize("ui.dialogs.helper_settings.yaml_not_editable")

View File

@ -790,21 +790,23 @@ export class EntityRegistrySettingsEditor extends LitElement {
<span <span
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.entity_registry.editor.configure_state", "ui.dialogs.entity_registry.editor.configure_state",
"integration", {
domainToName( integration: domainToName(
this.hass.localize, this.hass.localize,
this.helperConfigEntry.domain this.helperConfigEntry.domain
) ),
}
)}</span )}</span
> >
<span slot="secondary" <span slot="secondary"
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.entity_registry.editor.configure_state_secondary", "ui.dialogs.entity_registry.editor.configure_state_secondary",
"integration", {
domainToName( integration: domainToName(
this.hass.localize, this.hass.localize,
this.helperConfigEntry.domain this.helperConfigEntry.domain
) ),
}
)}</span )}</span
> >
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
@ -842,10 +844,11 @@ export class EntityRegistrySettingsEditor extends LitElement {
? html`<ha-alert alert-type="warning" ? html`<ha-alert alert-type="warning"
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.entity_registry.editor.enabled_cause", "ui.dialogs.entity_registry.editor.enabled_cause",
"cause", {
this.hass.localize( cause: this.hass.localize(
`config_entry.disabled_by.${this._disabledBy!}` `config_entry.disabled_by.${this._disabledBy!}`
) ),
}
)}</ha-alert )}</ha-alert
>` >`
: ""} : ""}
@ -876,8 +879,11 @@ export class EntityRegistrySettingsEditor extends LitElement {
? html`<ha-alert alert-type="warning" ? html`<ha-alert alert-type="warning"
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.entity_registry.editor.hidden_cause", "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!}`
),
}
)}</ha-alert )}</ha-alert
>` >`
: ""} : ""}
@ -1050,8 +1056,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.dialogs.entity_registry.editor.enabled_delay_confirm", "ui.dialogs.entity_registry.editor.enabled_delay_confirm",
"delay", { delay: result.reload_delay }
result.reload_delay
), ),
}); });
} }

View File

@ -184,8 +184,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.dialogs.entity_registry.editor.enabled_delay_confirm", "ui.dialogs.entity_registry.editor.enabled_delay_confirm",
"delay", { delay: result.reload_delay }
result.reload_delay
), ),
}); });
} }

View File

@ -525,8 +525,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)} )}
.hiddenLabel=${this.hass.localize( .hiddenLabel=${this.hass.localize(
"ui.panel.config.entities.picker.filter.hidden_entities", "ui.panel.config.entities.picker.filter.hidden_entities",
"number", { number: this._numHiddenEntities }
this._numHiddenEntities
)} )}
.filter=${this._filter} .filter=${this._filter}
selectable selectable
@ -554,8 +553,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
<p class="selected-txt"> <p class="selected-txt">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.entities.picker.selected", "ui.panel.config.entities.picker.selected",
"number", { number: this._selectedEntities.length }
this._selectedEntities.length
)} )}
</p> </p>
<div class="header-btns"> <div class="header-btns">
@ -797,8 +795,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.confirm_title", "ui.panel.config.entities.picker.enable_selected.confirm_title",
"number", { number: this._selectedEntities.length }
this._selectedEntities.length
), ),
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.confirm_text" "ui.panel.config.entities.picker.enable_selected.confirm_text"
@ -834,8 +831,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.dialogs.entity_registry.editor.enabled_delay_confirm", "ui.dialogs.entity_registry.editor.enabled_delay_confirm",
"delay", { delay: reload_delay }
reload_delay
), ),
}); });
} }
@ -847,8 +843,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.disable_selected.confirm_title", "ui.panel.config.entities.picker.disable_selected.confirm_title",
"number", { number: this._selectedEntities.length }
this._selectedEntities.length
), ),
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.entities.picker.disable_selected.confirm_text" "ui.panel.config.entities.picker.disable_selected.confirm_text"
@ -870,8 +865,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.hide_selected.confirm_title", "ui.panel.config.entities.picker.hide_selected.confirm_title",
"number", { number: this._selectedEntities.length }
this._selectedEntities.length
), ),
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.entities.picker.hide_selected.confirm_text" "ui.panel.config.entities.picker.hide_selected.confirm_text"
@ -901,8 +895,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
? "partly_" ? "partly_"
: "" : ""
}title`, }title`,
"number", { number: removeableEntities.length }
removeableEntities.length
), ),
text: text:
removeableEntities.length === this._selectedEntities.length removeableEntities.length === this._selectedEntities.length
@ -911,10 +904,10 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.confirm_partly_text", "ui.panel.config.entities.picker.remove_selected.confirm_partly_text",
"removable", {
removeableEntities.length, removable: removeableEntities.length,
"selected", selected: this._selectedEntities.length,
this._selectedEntities.length }
), ),
confirmText: this.hass.localize("ui.common.remove"), confirmText: this.hass.localize("ui.common.remove"),
dismissText: this.hass.localize("ui.common.cancel"), dismissText: this.hass.localize("ui.common.cancel"),

View File

@ -225,8 +225,7 @@ export class DialogHelperDetail extends LitElement {
<simple-tooltip animation-delay="0" <simple-tooltip animation-delay="0"
>${this.hass.localize( >${this.hass.localize(
"ui.dialogs.helper_settings.platform_not_loaded", "ui.dialogs.helper_settings.platform_not_loaded",
"platform", { platform: domain }
domain
)}</simple-tooltip )}</simple-tooltip
> >
` `
@ -250,10 +249,12 @@ export class DialogHelperDetail extends LitElement {
this._domain this._domain
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.helpers.dialog.create_platform", "ui.panel.config.helpers.dialog.create_platform",
"platform", {
platform:
this.hass.localize( this.hass.localize(
`ui.panel.config.helpers.types.${this._domain}` `ui.panel.config.helpers.types.${this._domain}`
) || this._domain ) || this._domain,
}
) )
: this.hass.localize("ui.panel.config.helpers.dialog.create_helper") : this.hass.localize("ui.panel.config.helpers.dialog.create_helper")
)} )}

View File

@ -135,8 +135,7 @@ export class HaConfigFlowCard extends LitElement {
const confirmed = await showConfirmationDialog(this, { const confirmed = await showConfirmationDialog(this, {
title: this.hass!.localize( title: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_ignore_title", "ui.panel.config.integrations.ignore.confirm_ignore_title",
"name", { name: localizeConfigFlowTitle(this.hass.localize, this.flow) }
localizeConfigFlowTitle(this.hass.localize, this.flow)
), ),
text: this.hass!.localize( text: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_ignore" "ui.panel.config.integrations.ignore.confirm_ignore"

View File

@ -306,8 +306,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
`ui.panel.config.integrations.config_entry.${ `ui.panel.config.integrations.config_entry.${
services ? "services" : "devices" services ? "services" : "devices"
}`, }`,
"count", { count: devices.length }
devices.length
)} )}
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
</ha-list-item> </ha-list-item>
@ -324,8 +323,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
></ha-svg-icon> ></ha-svg-icon>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entities`, `ui.panel.config.integrations.config_entry.entities`,
"count", { count: entities.length }
entities.length
)} )}
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
</ha-list-item> </ha-list-item>
@ -606,8 +604,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
html`<a href=${url} html`<a href=${url}
>${this.hass.localize( >${this.hass.localize(
`ui.panel.config.integrations.config_entry.${localizeKey}`, `ui.panel.config.integrations.config_entry.${localizeKey}`,
"count", { count: items.length }
items.length
)}</a )}</a
>` >`
); );
@ -620,8 +617,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
href=${`/config/entities?historyBack=1&config_entry=${item.entry_id}`} href=${`/config/entities?historyBack=1&config_entry=${item.entry_id}`}
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.integrations.config_entry.entities", "ui.panel.config.integrations.config_entry.entities",
"count", { count: entities.length }
entities.length
)}</a )}</a
>` >`
); );
@ -730,8 +726,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
<ha-svg-icon .path=${mdiDevices} slot="graphic"></ha-svg-icon> <ha-svg-icon .path=${mdiDevices} slot="graphic"></ha-svg-icon>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.devices`, `ui.panel.config.integrations.config_entry.devices`,
"count", { count: devices.length }
devices.length
)} )}
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
</ha-list-item> </ha-list-item>
@ -750,8 +745,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
></ha-svg-icon> ></ha-svg-icon>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.services`, `ui.panel.config.integrations.config_entry.services`,
"count", { count: services.length }
services.length
)} )}
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
</ha-list-item> </ha-list-item>
@ -768,8 +762,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
></ha-svg-icon> ></ha-svg-icon>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entities`, `ui.panel.config.integrations.config_entry.entities`,
"count", { count: entities.length }
entities.length
)} )}
<ha-icon-next slot="meta"></ha-icon-next> <ha-icon-next slot="meta"></ha-icon-next>
</ha-list-item> </ha-list-item>

View File

@ -47,8 +47,7 @@ export class HaIgnoredConfigEntryCard extends LitElement {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass!.localize( title: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_delete_ignore_title", "ui.panel.config.integrations.ignore.confirm_delete_ignore_title",
"name", { name: this.hass.localize(`component.${this.entry.domain}.title`) }
this.hass.localize(`component.${this.entry.domain}.title`)
), ),
text: this.hass!.localize( text: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_delete_ignore" "ui.panel.config.integrations.ignore.confirm_delete_ignore"

View File

@ -140,8 +140,7 @@ export class HaIntegrationCard extends LitElement {
`ui.panel.config.integrations.config_entry.${ `ui.panel.config.integrations.config_entry.${
services ? "services" : "devices" services ? "services" : "devices"
}`, }`,
"count", { count: devices.length }
devices.length
)} )}
</ha-button> </ha-button>
</a>` </a>`
@ -152,8 +151,7 @@ export class HaIntegrationCard extends LitElement {
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entities`, `ui.panel.config.integrations.config_entry.entities`,
"count", { count: entities.length }
entities.length
)} )}
</ha-button> </ha-button>
</a>` </a>`
@ -161,8 +159,7 @@ export class HaIntegrationCard extends LitElement {
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entries`, `ui.panel.config.integrations.config_entry.entries`,
"count", { count: this.items.length }
this.items.length
)} )}
</ha-button> </ha-button>
</a>`} </a>`}

View File

@ -110,15 +110,15 @@ class MqttSubscribeCard extends LitElement {
${this._messages.map( ${this._messages.map(
(msg) => html` (msg) => html`
<div class="event"> <div class="event">
${this.hass.localize( ${this.hass.localize("ui.panel.config.mqtt.message_received", {
"ui.panel.config.mqtt.message_received", id: msg.id,
"id", topic: msg.message.topic,
msg.id, time: formatTime(
"topic", msg.time,
msg.message.topic, this.hass!.locale,
"time", this.hass!.config
formatTime(msg.time, this.hass!.locale, this.hass!.config) ),
)} })}
<pre>${msg.payload}</pre> <pre>${msg.payload}</pre>
<div class="bottom"> <div class="bottom">
QoS: ${msg.message.qos} - Retain: QoS: ${msg.message.qos} - Retain:

View File

@ -78,11 +78,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
<div> <div>
<div class="model">${this.device.model}</div> <div class="model">${this.device.model}</div>
<div class="manuf"> <div class="manuf">
${this.hass.localize( ${this.hass.localize("ui.dialogs.zha_device_info.manuf", {
"ui.dialogs.zha_device_info.manuf", manufacturer: this.device.manufacturer,
"manufacturer", })}
this.device.manufacturer
)}
</div> </div>
</div> </div>
@ -191,8 +189,7 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.integrations.config_flow.error_saving_area", "ui.panel.config.integrations.config_flow.error_saving_area",
"error", { error: err.message }
err.message
), ),
}); });
picker.value = null; picker.value = null;

View File

@ -54,11 +54,9 @@ class ZHADevicePairingStatusCard extends LitElement {
? html` ? html`
<div class="model">${this.device.model}</div> <div class="model">${this.device.model}</div>
<div class="manuf"> <div class="manuf">
${this.hass.localize( ${this.hass.localize("ui.dialogs.zha_device_info.manuf", {
"ui.dialogs.zha_device_info.manuf", manufacturer: this.device.manufacturer,
"manufacturer", })}
this.device.manufacturer
)}
</div> </div>
` `
: nothing} : nothing}

View File

@ -138,8 +138,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.remove_failed_node.removal_finished", "ui.panel.config.zwave_js.remove_failed_node.removal_finished",
"id", { id: this._node!.node_id }
this._node!.node_id
)} )}
</p> </p>
</div> </div>

View File

@ -125,8 +125,7 @@ class DialogZWaveJSRemoveNode extends LitElement {
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.remove_node.exclusion_finished", "ui.panel.config.zwave_js.remove_node.exclusion_finished",
"id", { id: this._node!.node_id }
this._node!.node_id
)} )}
</p> </p>
</div> </div>

View File

@ -160,8 +160,8 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
<em> <em>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.node_config.attribution", "ui.panel.config.zwave_js.node_config.attribution",
"device_database", {
html`<a device_database: html`<a
rel="noreferrer noopener" rel="noreferrer noopener"
href=${this._nodeMetadata?.device_database_url || href=${this._nodeMetadata?.device_database_url ||
"https://devices.zwave-js.io"} "https://devices.zwave-js.io"}
@ -169,7 +169,8 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.zwave_js.node_config.zwave_js_device_database" "ui.panel.config.zwave_js.node_config.zwave_js_device_database"
)}</a )}</a
>` >`,
}
)} )}
</em> </em>
</p> </p>
@ -184,8 +185,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
<h3> <h3>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.node_config.endpoint", "ui.panel.config.zwave_js.node_config.endpoint",
"endpoint", { endpoint }
endpoint
)} )}
</h3> </h3>
<ha-card> <ha-card>

View File

@ -69,13 +69,11 @@ class DialogSystemLogDetail extends LitElement {
// Custom components with our official docs should not link to our docs // Custom components with our official docs should not link to our docs
!this._manifest.documentation.includes("://www.home-assistant.io")); !this._manifest.documentation.includes("://www.home-assistant.io"));
const title = this.hass.localize( const title = this.hass.localize("ui.panel.config.logs.details", {
"ui.panel.config.logs.details", level: html`<span class=${item.level}
"level",
html`<span class=${item.level}
>${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}</span >${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}</span
>` >`,
); });
return html` return html`
<ha-dialog open @closed=${this.closeDialog} hideActions .heading=${title}> <ha-dialog open @closed=${this.closeDialog} hideActions .heading=${title}>

View File

@ -179,10 +179,7 @@ class ErrorLogCard extends LitElement {
} catch (err: any) { } catch (err: any) {
this._error = this.hass.localize( this._error = this.hass.localize(
"ui.panel.config.logs.failed_get_logs", "ui.panel.config.logs.failed_get_logs",
"provider", { provider: this.provider, error: extractApiErrorMessage(err) }
this.provider,
"error",
extractApiErrorMessage(err)
); );
return; return;
} }

View File

@ -47,17 +47,14 @@ export class SystemLogCard extends LitElement {
} }
private _multipleMessages(item: LoggedError): string { private _multipleMessages(item: LoggedError): string {
return this.hass.localize( return this.hass.localize("ui.panel.config.logs.multiple_messages", {
"ui.panel.config.logs.multiple_messages", time: formatSystemLogTime(
"time",
formatSystemLogTime(
item.first_occurred, item.first_occurred,
this.hass.locale, this.hass.locale,
this.hass.config this.hass.config
), ),
"counter", counter: item.count,
item.count });
);
} }
private _getFilteredItems = memoizeOne( private _getFilteredItems = memoizeOne(
@ -122,8 +119,7 @@ export class SystemLogCard extends LitElement {
? html`<div class="card-content"> ? html`<div class="card-content">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.logs.no_issues_search", "ui.panel.config.logs.no_issues_search",
"term", { term: this.filter }
this.filter
)} )}
</div>` </div>`
: filteredItems.map( : filteredItems.map(

View File

@ -116,8 +116,7 @@ export class HassioNetwork extends LitElement {
? html`<p> ? html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.network.supervisor.connected_to", "ui.panel.config.network.supervisor.connected_to",
"ssid", { ssid: this._interface?.wifi?.ssid }
this._interface?.wifi?.ssid
)} )}
</p>` </p>`
: ""} : ""}

View File

@ -306,8 +306,7 @@ class DialogPersonDetail extends LitElement {
!(await showConfirmationDialog(this, { !(await showConfirmationDialog(this, {
text: this.hass!.localize( text: this.hass!.localize(
"ui.panel.config.person.detail.confirm_delete_user", "ui.panel.config.person.detail.confirm_delete_user",
"name", { name: this._name }
this._name
), ),
confirmText: this.hass!.localize( confirmText: this.hass!.localize(
"ui.panel.config.person.detail.delete" "ui.panel.config.person.detail.delete"

View File

@ -589,8 +589,7 @@ export class HaSceneEditor extends SubscribeMixin(
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.scene.editor.load_error_unknown", "ui.panel.config.scene.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
history.back(); history.back();

View File

@ -483,8 +483,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.script.editor.load_error_unknown", "ui.panel.config.script.editor.load_error_unknown",
"err_no", { err_no: resp.status_code || resp.code }
resp.status_code || resp.code
) )
); );
history.back(); history.back();
@ -628,11 +627,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
ev.stopPropagation(); ev.stopPropagation();
await triggerScript(this.hass, this.scriptId!); await triggerScript(this.hass, this.scriptId!);
showToast(this, { showToast(this, {
message: this.hass.localize( message: this.hass.localize("ui.notification_toast.triggered", {
"ui.notification_toast.triggered", name: this._config!.alias,
"name", }),
this._config!.alias
),
}); });
} }

View File

@ -303,10 +303,12 @@ class HaScriptPicker extends LitElement {
this._activeFilters = [ this._activeFilters = [
this.hass.localize( this.hass.localize(
"ui.panel.config.script.picker.filtered_by_blueprint", "ui.panel.config.script.picker.filtered_by_blueprint",
"name", {
name:
!blueprintMeta || "error" in blueprintMeta !blueprintMeta || "error" in blueprintMeta
? blueprint ? blueprint
: blueprintMeta.metadata.name || blueprint : blueprintMeta.metadata.name || blueprint,
}
), ),
]; ];
} }
@ -353,11 +355,9 @@ class HaScriptPicker extends LitElement {
} }
await triggerScript(this.hass, entry.unique_id); await triggerScript(this.hass, entry.unique_id);
showToast(this, { showToast(this, {
message: this.hass.localize( message: this.hass.localize("ui.notification_toast.triggered", {
"ui.notification_toast.triggered", name: computeStateName(script),
"name", }),
computeStateName(script)
),
}); });
}; };
@ -419,8 +419,7 @@ class HaScriptPicker extends LitElement {
await showAlertDialog(this, { await showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.config.script.editor.load_error_unknown", "ui.panel.config.script.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
} }
@ -459,8 +458,7 @@ class HaScriptPicker extends LitElement {
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.script.editor.load_error_unknown", "ui.panel.config.script.editor.load_error_unknown",
"err_no", { err_no: err.status_code }
err.status_code
), ),
}); });
} }

View File

@ -118,18 +118,16 @@ class DialogTagDetail
? html` ? html`
<div> <div>
<p> <p>
${this.hass!.localize( ${this.hass!.localize("ui.panel.config.tag.detail.usage", {
"ui.panel.config.tag.detail.usage", companion_link: html`<a
"companion_link",
html`<a
href="https://companion.home-assistant.io/" href="https://companion.home-assistant.io/"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.tag.detail.companion_apps" "ui.panel.config.tag.detail.companion_apps"
)}</a )}</a
>` >`,
)} })}
</p> </p>
</div> </div>
${this._qrCode ${this._qrCode
@ -251,11 +249,9 @@ class DialogTagDetail
); );
this._qrCode = html`<img this._qrCode = html`<img
alt=${this.hass.localize( alt=${this.hass.localize("ui.panel.config.tag.qr_code_image", {
"ui.panel.config.tag.qr_code_image", name: this._name,
"name", })}
this._name
)}
src=${canvas.toDataURL()} src=${canvas.toDataURL()}
></img>`; ></img>`;
} }

View File

@ -207,11 +207,9 @@ export class HaConfigTags extends SubscribeMixin(LitElement) {
private _handleAutomationClick = (ev: Event) => { private _handleAutomationClick = (ev: Event) => {
const tag = (ev.currentTarget as any).tag; const tag = (ev.currentTarget as any).tag;
const data = { const data = {
alias: this.hass.localize( alias: this.hass.localize("ui.panel.config.tag.automation_title", {
"ui.panel.config.tag.automation_title", name: tag.name || tag.id,
"name", }),
tag.name || tag.id
),
trigger: [{ platform: "tag", tag_id: tag.id } as TagTrigger], trigger: [{ platform: "tag", tag_id: tag.id } as TagTrigger],
}; };
showAutomationEditor(data); showAutomationEditor(data);
@ -225,18 +223,16 @@ export class HaConfigTags extends SubscribeMixin(LitElement) {
title: this.hass.localize("ui.panel.config.tag.caption"), title: this.hass.localize("ui.panel.config.tag.caption"),
text: html` text: html`
<p> <p>
${this.hass.localize( ${this.hass.localize("ui.panel.config.tag.detail.usage", {
"ui.panel.config.tag.detail.usage", companion_link: html`<a
"companion_link",
html`<a
href="https://companion.home-assistant.io/" href="https://companion.home-assistant.io/"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.config.tag.detail.companion_apps" "ui.panel.config.tag.detail.companion_apps"
)}</a )}</a
>` >`,
)} })}
</p> </p>
<p> <p>
<a <a
@ -302,11 +298,9 @@ export class HaConfigTags extends SubscribeMixin(LitElement) {
if ( if (
!(await showConfirmationDialog(this, { !(await showConfirmationDialog(this, {
title: this.hass!.localize("ui.panel.config.tag.confirm_remove_title"), title: this.hass!.localize("ui.panel.config.tag.confirm_remove_title"),
text: this.hass.localize( text: this.hass.localize("ui.panel.config.tag.confirm_remove", {
"ui.panel.config.tag.confirm_remove", tag: selectedTag.name || selectedTag.id,
"tag", }),
selectedTag.name || selectedTag.id
),
dismissText: this.hass!.localize("ui.common.cancel"), dismissText: this.hass!.localize("ui.common.cancel"),
confirmText: this.hass!.localize("ui.common.remove"), confirmText: this.hass!.localize("ui.common.remove"),
})) }))

View File

@ -212,8 +212,7 @@ export class HaConfigUsers extends LitElement {
!(await showConfirmationDialog(this, { !(await showConfirmationDialog(this, {
title: this.hass!.localize( title: this.hass!.localize(
"ui.panel.config.users.editor.confirm_user_deletion_title", "ui.panel.config.users.editor.confirm_user_deletion_title",
"name", { name: entry.name }
entry.name
), ),
text: this.hass!.localize( text: this.hass!.localize(
"ui.panel.config.users.editor.confirm_user_deletion_text" "ui.panel.config.users.editor.confirm_user_deletion_text"

View File

@ -234,12 +234,13 @@ export class CloudAlexaPref extends LitElement {
alert( alert(
`${this.hass!.localize( `${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.state_reporting_error", "ui.panel.config.cloud.account.alexa.state_reporting_error",
"enable_disable", {
this.hass!.localize( enable_disable: this.hass!.localize(
toggle.checked toggle.checked
? "ui.panel.config.cloud.account.alexa.enable" ? "ui.panel.config.cloud.account.alexa.enable"
: "ui.panel.config.cloud.account.alexa.disable" : "ui.panel.config.cloud.account.alexa.disable"
) ),
}
)} ${err.message}` )} ${err.message}`
); );
toggle.checked = !toggle.checked; toggle.checked = !toggle.checked;

View File

@ -532,8 +532,7 @@ export class VoiceAssistantsExpose extends LitElement {
)} )}
.hiddenLabel=${this.hass.localize( .hiddenLabel=${this.hass.localize(
"ui.panel.config.entities.picker.filter.hidden_entities", "ui.panel.config.entities.picker.filter.hidden_entities",
"number", { number: this._numHiddenEntities }
this._numHiddenEntities
)} )}
.filter=${this._filter} .filter=${this._filter}
selectable selectable
@ -557,8 +556,7 @@ export class VoiceAssistantsExpose extends LitElement {
<p class="selected-txt"> <p class="selected-txt">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.entities.picker.selected", "ui.panel.config.entities.picker.selected",
"number", { number: this._selectedEntities.length }
this._selectedEntities.length
)} )}
</p> </p>
<div class="header-btns"> <div class="header-btns">

View File

@ -102,10 +102,7 @@ export class HaPanelCustom extends ReactiveElement {
!confirm( !confirm(
`${this.hass.localize( `${this.hass.localize(
"ui.panel.custom.external_panel.question_trust", "ui.panel.custom.external_panel.question_trust",
"name", { name: config.name, link: tempA.href }
config.name,
"link",
tempA.href
)} )}
${this.hass.localize( ${this.hass.localize(

View File

@ -74,8 +74,7 @@ class EventSubscribeCard extends LitElement {
<div class="event"> <div class="event">
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.developer-tools.tabs.events.event_fired", "ui.panel.developer-tools.tabs.events.event_fired",
"name", { name: event.id }
event.id
)} )}
${formatTime( ${formatTime(
new Date(event.event.time_fired), new Date(event.event.time_fired),

View File

@ -332,8 +332,7 @@ class HaPanelDevService extends LitElement {
) { ) {
return localize( return localize(
`ui.panel.developer-tools.tabs.services.errors.${errorCategory}.missing_required_field`, `ui.panel.developer-tools.tabs.services.errors.${errorCategory}.missing_required_field`,
"key", { key: field.key }
field.key
); );
} }
} }
@ -426,11 +425,9 @@ class HaPanelDevService extends LitElement {
forwardHaptic("failure"); forwardHaptic("failure");
button.actionError(); button.actionError();
this._error = this._error =
this.hass.localize( this.hass.localize("ui.notification_toast.service_call_failed", {
"ui.notification_toast.service_call_failed", service: this._serviceData!.service!,
"service", }) + ` ${err.message}`;
this._serviceData!.service!
) + ` ${err.message}`;
return; return;
} }
button.actionSuccess(); button.actionSuccess();

View File

@ -186,8 +186,7 @@ export class DeveloperYamlConfig extends LitElement {
) || ) ||
this.hass.localize( this.hass.localize(
"ui.panel.developer-tools.tabs.yaml.section.reloading.reload", "ui.panel.developer-tools.tabs.yaml.section.reloading.reload",
"domain", { domain: domainToName(this.hass.localize, domain) }
domainToName(this.hass.localize, domain)
)} )}
</ha-call-service-button> </ha-call-service-button>
</div> </div>

View File

@ -104,8 +104,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
<hui-warning <hui-warning
>${this.hass.localize( >${this.hass.localize(
"ui.panel.lovelace.warning.entity_unavailable", "ui.panel.lovelace.warning.entity_unavailable",
"entity", { entity: this._config.entity }
this._config.entity
)}</hui-warning )}</hui-warning
> >
`; `;
@ -116,8 +115,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
<hui-warning <hui-warning
>${this.hass.localize( >${this.hass.localize(
"ui.panel.lovelace.warning.entity_non_numeric", "ui.panel.lovelace.warning.entity_non_numeric",
"entity", { entity: this._config.entity }
this._config.entity
)}</hui-warning )}</hui-warning
> >
`; `;

View File

@ -106,11 +106,9 @@ export class HuiLogbookCard extends LitElement implements LovelaceCard {
if (!isComponentLoaded(this.hass, "logbook")) { if (!isComponentLoaded(this.hass, "logbook")) {
return html` return html`
<hui-warning> <hui-warning>
${this.hass.localize( ${this.hass.localize("ui.components.logbook.not_loaded", {
"ui.components.logbook.not_loaded", platform: "logbook",
"platform", })}</hui-warning
"logbook"
)}</hui-warning
> >
`; `;
} }

View File

@ -212,11 +212,9 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
if (stateObj.state === UNAVAILABLE) { if (stateObj.state === UNAVAILABLE) {
return html` return html`
<ha-card class="unavailable" @click=${this._handleAction}> <ha-card class="unavailable" @click=${this._handleAction}>
${this.hass.localize( ${this.hass.localize("ui.panel.lovelace.warning.entity_unavailable", {
"ui.panel.lovelace.warning.entity_unavailable", entity: `${computeStateName(stateObj)} (${this._config.entity})`,
"entity", })}
`${computeStateName(stateObj)} (${this._config.entity})`
)}
</ha-card> </ha-card>
`; `;
} }

View File

@ -20,45 +20,39 @@ function computeActionTooltip(
return ""; return "";
} }
let tooltip = let tooltip = isHold
(isHold
? hass.localize("ui.panel.lovelace.cards.picture-elements.hold") ? hass.localize("ui.panel.lovelace.cards.picture-elements.hold")
: hass.localize("ui.panel.lovelace.cards.picture-elements.tap")) + " "; : hass.localize("ui.panel.lovelace.cards.picture-elements.tap");
switch (config.action) { switch (config.action) {
case "navigate": case "navigate":
tooltip += `${hass.localize( tooltip += ` ${hass.localize(
"ui.panel.lovelace.cards.picture-elements.navigate_to", "ui.panel.lovelace.cards.picture-elements.navigate_to",
"location", { location: config.navigation_path }
config.navigation_path
)}`; )}`;
break; break;
case "url": case "url":
tooltip += `${hass.localize( tooltip += ` ${hass.localize(
"ui.panel.lovelace.cards.picture-elements.url", "ui.panel.lovelace.cards.picture-elements.url",
"url_path", { url_path: config.url_path }
config.url_path
)}`; )}`;
break; break;
case "toggle": case "toggle":
tooltip += `${hass.localize( tooltip += ` ${hass.localize(
"ui.panel.lovelace.cards.picture-elements.toggle", "ui.panel.lovelace.cards.picture-elements.toggle",
"name", { name: state }
state
)}`; )}`;
break; break;
case "call-service": case "call-service":
tooltip += `${hass.localize( tooltip += `${hass.localize(
"ui.panel.lovelace.cards.picture-elements.call_service", "ui.panel.lovelace.cards.picture-elements.call_service",
"name", { name: config.service }
config.service
)}`; )}`;
break; break;
case "more-info": case "more-info":
tooltip += `${hass.localize( tooltip += `${hass.localize(
"ui.panel.lovelace.cards.picture-elements.more_info", "ui.panel.lovelace.cards.picture-elements.more_info",
"name", { name: state }
state
)}`; )}`;
break; break;
} }

View File

@ -555,13 +555,11 @@ export const generateDefaultViewConfig = (
title: title:
device.name_by_user || device.name_by_user ||
device.name || device.name ||
localize( localize("ui.panel.config.devices.unnamed_device", {
"ui.panel.config.devices.unnamed_device", type: localize(
"type",
localize(
`ui.panel.config.devices.type.${device.entry_type || "device"}` `ui.panel.config.devices.type.${device.entry_type || "device"}`
)
), ),
}),
} }
) )
); );

View File

@ -74,15 +74,14 @@ export const handleAction = async (
!(await showConfirmationDialog(node, { !(await showConfirmationDialog(node, {
text: text:
actionConfig.confirmation.text || actionConfig.confirmation.text ||
hass.localize( hass.localize("ui.panel.lovelace.cards.actions.action_confirmation", {
"ui.panel.lovelace.cards.actions.action_confirmation", action:
"action",
serviceName || serviceName ||
hass.localize( hass.localize(
`ui.panel.lovelace.editor.action-editor.actions.${actionConfig.action}` `ui.panel.lovelace.editor.action-editor.actions.${actionConfig.action}`
) || ) ||
actionConfig.action actionConfig.action,
), }),
})) }))
) { ) {
return; return;

View File

@ -9,11 +9,9 @@ export const createEntityNotFoundWarning = (
entityId: string entityId: string
) => ) =>
hass.config.state !== STATE_NOT_RUNNING hass.config.state !== STATE_NOT_RUNNING
? hass.localize( ? hass.localize("ui.panel.lovelace.warning.entity_not_found", {
"ui.panel.lovelace.warning.entity_not_found", entity: entityId || "[empty]",
"entity", })
entityId || "[empty]"
)
: hass.localize("ui.panel.lovelace.warning.starting"); : hass.localize("ui.panel.lovelace.warning.starting");
@customElement("hui-warning") @customElement("hui-warning")

View File

@ -69,8 +69,7 @@ export class HuiCreateDialogCard
const title = this._viewConfig.title const title = this._viewConfig.title
? this.hass!.localize( ? this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.pick_card_view_title", "ui.panel.lovelace.editor.edit_card.pick_card_view_title",
"name", { name: `"${this._viewConfig.title}"` }
`"${this._viewConfig.title}"`
) )
: this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card"); : this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card");

View File

@ -165,15 +165,13 @@ export class HuiDialogEditCard
} }
heading = this.hass!.localize( heading = this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.typed_header", "ui.panel.lovelace.editor.edit_card.typed_header",
"type", { type: cardName }
cardName
); );
} else if (!this._cardConfig) { } else if (!this._cardConfig) {
heading = this._viewConfig.title heading = this._viewConfig.title
? this.hass!.localize( ? this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.pick_card_view_title", "ui.panel.lovelace.editor.edit_card.pick_card_view_title",
"name", { name: this._viewConfig.title }
`"${this._viewConfig.title}"`
) )
: this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card"); : this.hass!.localize("ui.panel.lovelace.editor.edit_card.pick_card");
} else { } else {

View File

@ -45,10 +45,11 @@ export class HuiCreateDialogHeaderFooter
this.hass, this.hass,
this.hass!.localize( this.hass!.localize(
`ui.panel.lovelace.editor.header-footer.choose_header_footer`, `ui.panel.lovelace.editor.header-footer.choose_header_footer`,
"type", {
this.hass!.localize( type: this.hass!.localize(
`ui.panel.lovelace.editor.header-footer.${this._params.type}` `ui.panel.lovelace.editor.header-footer.${this._params.type}`
) ),
}
) )
)} )}
@keydown=${this._ignoreKeydown} @keydown=${this._ignoreKeydown}

View File

@ -234,11 +234,9 @@ export abstract class HuiElementEditor<T, C = any> extends LitElement {
${this._guiSupported === false && this.configElementType ${this._guiSupported === false && this.configElementType
? html` ? html`
<div class="info"> <div class="info">
${this.hass.localize( ${this.hass.localize("ui.errors.config.editor_not_available", {
"ui.errors.config.editor_not_available", type: this.configElementType,
"type", })}
this.configElementType
)}
</div> </div>
` `
: ""} : ""}

View File

@ -138,8 +138,7 @@ export class HuiDialogEditView extends LitElement {
return this.hass!.localize( return this.hass!.localize(
"ui.panel.lovelace.editor.edit_view.header_name", "ui.panel.lovelace.editor.edit_view.header_name",
"name", { name: this._config.title }
this._config.title
); );
} }
@ -376,10 +375,10 @@ export class HuiDialogEditView extends LitElement {
`ui.panel.lovelace.views.confirm_delete${ `ui.panel.lovelace.views.confirm_delete${
this._cards?.length ? "_existing_cards" : "" this._cards?.length ? "_existing_cards" : ""
}_text`, }_text`,
"name", {
this._config?.title || "Unnamed view", name: this._config?.title || "Unnamed view",
"number", number: this._cards?.length || 0,
this._cards?.length || 0 }
), ),
confirm: () => this._delete(), confirm: () => this._delete(),
}); });

View File

@ -60,10 +60,7 @@ class HuiStateLabelElement extends LitElement implements LovelaceElement {
<hui-warning-element <hui-warning-element
label=${this.hass.localize( label=${this.hass.localize(
"ui.panel.lovelace.warning.attribute_not_found", "ui.panel.lovelace.warning.attribute_not_found",
"attribute", { attribute: this._config.attribute, entity: this._config.entity }
this._config.attribute,
"entity",
this._config.entity
)} )}
></hui-warning-element> ></hui-warning-element>
`; `;

View File

@ -53,12 +53,11 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
${stateObj.state === "on" ${stateObj.state === "on"
? html`<mwc-button @click=${this._cancelScript}> ? html`<mwc-button @click=${this._cancelScript}>
${stateObj.attributes.mode !== "single" && ${stateObj.attributes.mode !== "single" &&
(stateObj.attributes.current || 0) > 0 stateObj.attributes.current &&
? this.hass.localize( stateObj.attributes.current > 0
"ui.card.script.cancel_multiple", ? this.hass.localize("ui.card.script.cancel_multiple", {
"number", number: stateObj.attributes.current,
stateObj.attributes.current })
)
: this.hass.localize("ui.card.script.cancel")} : this.hass.localize("ui.card.script.cancel")}
</mwc-button>` </mwc-button>`
: ""} : ""}

View File

@ -213,8 +213,7 @@ class LovelaceFullConfigEditor extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_remove", "ui.panel.lovelace.editor.raw_editor.error_remove",
"error", { error: err }
err
), ),
}); });
} }
@ -263,8 +262,7 @@ class LovelaceFullConfigEditor extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_parse_yaml", "ui.panel.lovelace.editor.raw_editor.error_parse_yaml",
"error", { error: err }
err
), ),
}); });
this._saving = false; this._saving = false;
@ -280,8 +278,7 @@ class LovelaceFullConfigEditor extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_invalid_config", "ui.panel.lovelace.editor.raw_editor.error_invalid_config",
"error", { error: err }
err
), ),
}); });
return; return;
@ -300,8 +297,7 @@ class LovelaceFullConfigEditor extends LitElement {
showAlertDialog(this, { showAlertDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_save_yaml", "ui.panel.lovelace.editor.raw_editor.error_save_yaml",
"error", { error: err }
err
), ),
}); });
} }

View File

@ -380,23 +380,19 @@ class HaPanelMy extends LitElement {
switch (this._error) { switch (this._error) {
case "not_supported": case "not_supported":
error = error =
this.hass.localize( this.hass.localize("ui.panel.my.not_supported", {
"ui.panel.my.not_supported", link: html`<a
"link",
html`<a
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
href="https://my.home-assistant.io/faq.html#supported-pages" href="https://my.home-assistant.io/faq.html#supported-pages"
>${this.hass.localize("ui.panel.my.faq_link")}</a >${this.hass.localize("ui.panel.my.faq_link")}</a
>` >`,
) || "This redirect is not supported."; }) || "This redirect is not supported.";
break; break;
case "no_component": case "no_component":
error = error =
this.hass.localize( this.hass.localize("ui.panel.my.component_not_loaded", {
"ui.panel.my.component_not_loaded", integration: html`<a
"integration",
html`<a
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
href=${documentationUrl( href=${documentationUrl(
@ -407,32 +403,28 @@ class HaPanelMy extends LitElement {
this.hass.localize, this.hass.localize,
this._redirect!.component! this._redirect!.component!
)}</a )}</a
>` >`,
) || "This redirect is not supported."; }) || "This redirect is not supported.";
break; break;
case "no_supervisor": case "no_supervisor":
error = this.hass.localize( error = this.hass.localize("ui.panel.my.no_supervisor", {
"ui.panel.my.no_supervisor", docs_link: html`<a
"docs_link",
html`<a
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
href=${documentationUrl(this.hass, "/installation")} href=${documentationUrl(this.hass, "/installation")}
>${this.hass.localize("ui.panel.my.documentation")}</a >${this.hass.localize("ui.panel.my.documentation")}</a
>` >`,
); });
break; break;
case "not_app": case "not_app":
error = this.hass.localize( error = this.hass.localize("ui.panel.my.not_app", {
"ui.panel.my.not_app", link: html`<a
"link",
html`<a
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
href="https://companion.home-assistant.io/download" href="https://companion.home-assistant.io/download"
>${this.hass.localize("ui.panel.my.download_app")}</a >${this.hass.localize("ui.panel.my.download_app")}</a
>` >`,
); });
break; break;
default: default:
error = this.hass.localize("ui.panel.my.error") || "Unknown error"; error = this.hass.localize("ui.panel.my.error") || "Unknown error";

View File

@ -97,8 +97,7 @@ class HaMfaModuleSetupFlow extends LitElement {
? html`<p> ? html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.profile.mfa_setup.step_done", "ui.panel.profile.mfa_setup.step_done",
"step", { step: this._step.title }
this._step.title
)} )}
</p>` </p>`
: this._step.type === "form" : this._step.type === "form"

Some files were not shown because too many files have changed in this diff Show More