diff --git a/src/data/integration.ts b/src/data/integration.ts index 7607bd3dcb..9290775bcd 100644 --- a/src/data/integration.ts +++ b/src/data/integration.ts @@ -21,7 +21,7 @@ export const integrationIssuesUrl = (domain: string) => `https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+${domain}%22`; export const domainToName = (localize: LocalizeFunc, domain: string) => - localize(`domain.${domain}`) || domain; + localize(`component.${domain}.title`) || domain; export const fetchIntegrationManifests = (hass: HomeAssistant) => hass.callWS({ type: "manifest/list" }); diff --git a/src/dialogs/domain-toggler/dialog-domain-toggler.ts b/src/dialogs/domain-toggler/dialog-domain-toggler.ts index 3d27b4f089..14fac5294f 100644 --- a/src/dialogs/domain-toggler/dialog-domain-toggler.ts +++ b/src/dialogs/domain-toggler/dialog-domain-toggler.ts @@ -12,6 +12,7 @@ import { PolymerChangedEvent } from "../../polymer-types"; import { haStyleDialog } from "../../resources/styles"; import { HomeAssistant } from "../../types"; import { HaDomainTogglerDialogParams } from "./show-dialog-domain-toggler"; +import { domainToName } from "../../data/integration"; @customElement("dialog-domain-toggler") class DomainTogglerDialog extends LitElement { @@ -29,7 +30,7 @@ class DomainTogglerDialog extends LitElement { } const domains = this._params.domains - .map((domain) => [this.hass.localize(`domain.${domain}`), domain]) + .map((domain) => [domainToName(this.hass.localize, domain), domain]) .sort(); return html` diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts index 0c556dfc68..178ebeff97 100644 --- a/src/dialogs/notifications/configurator-notification-item.ts +++ b/src/dialogs/notifications/configurator-notification-item.ts @@ -10,6 +10,7 @@ import { fireEvent } from "../../common/dom/fire_event"; import { PersitentNotificationEntity } from "../../data/persistent_notification"; import { HomeAssistant } from "../../types"; import "./notification-item-template"; +import { domainToName } from "../../data/integration"; @customElement("configurator-notification-item") export class HuiConfiguratorNotificationItem extends LitElement { @@ -24,7 +25,9 @@ export class HuiConfiguratorNotificationItem extends LitElement { return html` - ${this.hass.localize("domain.configurator")} + + ${domainToName(this.hass.localize, "configurator")} +
${this.hass.localize( diff --git a/src/panels/config/automation/thingtalk/ha-thingtalk-placeholders.ts b/src/panels/config/automation/thingtalk/ha-thingtalk-placeholders.ts index ea937d71a3..0e233445a8 100644 --- a/src/panels/config/automation/thingtalk/ha-thingtalk-placeholders.ts +++ b/src/panels/config/automation/thingtalk/ha-thingtalk-placeholders.ts @@ -27,6 +27,7 @@ import { PolymerChangedEvent } from "../../../../polymer-types"; import { haStyleDialog } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; import { Placeholder, PlaceholderContainer } from "./dialog-thingtalk"; +import { domainToName } from "../../../../data/integration"; declare global { // for fire event @@ -320,7 +321,7 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) { private _getLabel(domains: string[], deviceClasses?: string[]) { return `${domains - .map((domain) => this.hass.localize(`domain.${domain}`)) + .map((domain) => domainToName(this.hass.localize, domain)) .join(", ")}${ deviceClasses ? ` of type ${deviceClasses.join(", ")}` : "" }`; @@ -410,7 +411,7 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) { if (entities.length === 0) { // Should not happen because we filter the device picker on domain this._error = `No ${placeholder.domains - .map((domain) => this.hass.localize(`domain.${domain}`)) + .map((domain) => domainToName(this.hass.localize, domain)) .join(", ")} entities found in this device.`; } else if (entities.length === 1) { applyPatch( diff --git a/src/panels/developer-tools/info/integrations-card.ts b/src/panels/developer-tools/info/integrations-card.ts index 12b6e29f59..980b554012 100644 --- a/src/panels/developer-tools/info/integrations-card.ts +++ b/src/panels/developer-tools/info/integrations-card.ts @@ -12,6 +12,7 @@ import { integrationIssuesUrl, IntegrationManifest, fetchIntegrationManifests, + domainToName, } from "../../../data/integration"; import { HomeAssistant } from "../../../types"; @@ -48,7 +49,7 @@ class IntegrationsCard extends LitElement { /> - ${manifest?.name}
+ ${domainToName(this.hass.localize, domain)}
${domain} ${!manifest diff --git a/src/panels/developer-tools/info/system-health-card.ts b/src/panels/developer-tools/info/system-health-card.ts index d595b494bc..2fdec54f37 100644 --- a/src/panels/developer-tools/info/system-health-card.ts +++ b/src/panels/developer-tools/info/system-health-card.ts @@ -13,6 +13,7 @@ import { SystemHealthInfo, } from "../../../data/system_health"; import { HomeAssistant } from "../../../types"; +import { domainToName } from "../../../data/integration"; const sortKeys = (a: string, b: string) => { if (a === "homeassistant") { @@ -64,7 +65,7 @@ class SystemHealthCard extends LitElement { } if (domain !== "homeassistant") { sections.push( - html`

${this.hass.localize(`domain.${domain}`) || domain}

` + html`

${domainToName(this.hass.localize, domain)}

` ); } sections.push(html` @@ -76,7 +77,7 @@ class SystemHealthCard extends LitElement { } return html` - +
${sections}
`; diff --git a/src/panels/developer-tools/logs/dialog-system-log-detail.ts b/src/panels/developer-tools/logs/dialog-system-log-detail.ts index 255884558a..cfa468c93a 100644 --- a/src/panels/developer-tools/logs/dialog-system-log-detail.ts +++ b/src/panels/developer-tools/logs/dialog-system-log-detail.ts @@ -73,10 +73,7 @@ class DialogSystemLogDetail extends LitElement { ${integration ? html`
- Integration: - ${this._manifest - ? this._manifest.name - : domainToName(this.hass.localize, integration)} + Integration: ${domainToName(this.hass.localize, integration)} ${!this._manifest || // Can happen with custom integrations !this._manifest.documentation diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index a5aafbadeb..6190d6e4fb 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -41,6 +41,7 @@ import { } from "../cards/types"; import { processEditorEntities } from "../editor/process-editor-entities"; import { LovelaceRowConfig, WeblinkConfig } from "../entity-rows/types"; +import { domainToName } from "../../../data/integration"; const DEFAULT_VIEW_ENTITY_ID = "group.default_view"; const DOMAINS_BADGES = [ @@ -301,7 +302,7 @@ const generateViewConfig = ( entities[entityId], ]), { - title: localize(`domain.${domain}`), + title: domainToName(localize, domain), } ) ); diff --git a/src/panels/lovelace/ha-panel-lovelace.ts b/src/panels/lovelace/ha-panel-lovelace.ts index b0e1d7a4fc..e405ac902f 100644 --- a/src/panels/lovelace/ha-panel-lovelace.ts +++ b/src/panels/lovelace/ha-panel-lovelace.ts @@ -25,6 +25,7 @@ import { loadLovelaceResources } from "./common/load-resources"; import { showSaveDialog } from "./editor/show-save-config-dialog"; import "./hui-root"; import { Lovelace } from "./types"; +import { domainToName } from "../../data/integration"; (window as any).loadCardHelpers = () => import("./custom-card-helpers"); @@ -113,7 +114,7 @@ class LovelacePanel extends LitElement { if (state === "error") { return html` diff --git a/src/translations/en.json b/src/translations/en.json index 1d2cb0a058..cceeafa19a 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1,48 +1,4 @@ { - "domain": { - "alarm_control_panel": "Alarm control panel", - "automation": "Automation", - "binary_sensor": "Binary sensor", - "calendar": "Calendar", - "camera": "Camera", - "climate": "Climate", - "configurator": "Configurator", - "conversation": "Conversation", - "cover": "Cover", - "device_tracker": "Device tracker", - "fan": "Fan", - "group": "Group", - "hassio": "Hass.io", - "history_graph": "History graph", - "homeassistant": "Home Assistant", - "image_processing": "Image processing", - "input_boolean": "Input boolean", - "input_datetime": "Input datetime", - "input_number": "Input number", - "input_select": "Input select", - "input_text": "Input text", - "light": "Light", - "lock": "Lock", - "lovelace": "Lovelace", - "mailbox": "Mailbox", - "media_player": "Media player", - "notify": "Notify", - "person": "Person", - "plant": "Plant", - "proximity": "Proximity", - "remote": "Remote", - "scene": "Scene", - "script": "Script", - "sensor": "Sensor", - "sun": "Sun", - "switch": "Switch", - "system_health": "System Health", - "updater": "Updater", - "vacuum": "Vacuum", - "weblink": "Weblink", - "zha": "ZHA", - "zwave": "Z-Wave" - }, "panel": { "calendar": "Calendar", "config": "Configuration",