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}>
${this.hass.localize(
"ui.panel.page-demo.cards.demo.demo_by",
"name",
conf.authorName
{ name: conf.authorName }
)}
</a>
</small>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -177,10 +177,10 @@ export const computeUpdateStateDisplay = (
if (updateIsInstalling(stateObj)) {
const supportsProgress =
supportsFeature(stateObj, UPDATE_SUPPORT_PROGRESS) &&
typeof typeof attributes.in_progress === "number";
typeof attributes.in_progress === "number";
if (supportsProgress) {
return hass.localize("ui.card.update.installing_with_progress", {
progress: attributes.in_progress,
progress: attributes.in_progress as number,
});
}
return hass.localize("ui.card.update.installing");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -225,8 +225,7 @@ export class DialogHelperDetail extends LitElement {
<simple-tooltip animation-delay="0"
>${this.hass.localize(
"ui.dialogs.helper_settings.platform_not_loaded",
"platform",
domain
{ platform: domain }
)}</simple-tooltip
>
`
@ -250,10 +249,12 @@ export class DialogHelperDetail extends LitElement {
this._domain
? this.hass.localize(
"ui.panel.config.helpers.dialog.create_platform",
"platform",
{
platform:
this.hass.localize(
`ui.panel.config.helpers.types.${this._domain}`
) || this._domain
) || this._domain,
}
)
: 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, {
title: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_ignore_title",
"name",
localizeConfigFlowTitle(this.hass.localize, this.flow)
{ name: localizeConfigFlowTitle(this.hass.localize, this.flow) }
),
text: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_ignore"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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