mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Update domain translation string (#5558)
This commit is contained in:
parent
b516f10a35
commit
97c454aa0d
@ -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`;
|
`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) =>
|
export const domainToName = (localize: LocalizeFunc, domain: string) =>
|
||||||
localize(`domain.${domain}`) || domain;
|
localize(`component.${domain}.title`) || domain;
|
||||||
|
|
||||||
export const fetchIntegrationManifests = (hass: HomeAssistant) =>
|
export const fetchIntegrationManifests = (hass: HomeAssistant) =>
|
||||||
hass.callWS<IntegrationManifest[]>({ type: "manifest/list" });
|
hass.callWS<IntegrationManifest[]>({ type: "manifest/list" });
|
||||||
|
@ -12,6 +12,7 @@ import { PolymerChangedEvent } from "../../polymer-types";
|
|||||||
import { haStyleDialog } from "../../resources/styles";
|
import { haStyleDialog } from "../../resources/styles";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import { HaDomainTogglerDialogParams } from "./show-dialog-domain-toggler";
|
import { HaDomainTogglerDialogParams } from "./show-dialog-domain-toggler";
|
||||||
|
import { domainToName } from "../../data/integration";
|
||||||
|
|
||||||
@customElement("dialog-domain-toggler")
|
@customElement("dialog-domain-toggler")
|
||||||
class DomainTogglerDialog extends LitElement {
|
class DomainTogglerDialog extends LitElement {
|
||||||
@ -29,7 +30,7 @@ class DomainTogglerDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const domains = this._params.domains
|
const domains = this._params.domains
|
||||||
.map((domain) => [this.hass.localize(`domain.${domain}`), domain])
|
.map((domain) => [domainToName(this.hass.localize, domain), domain])
|
||||||
.sort();
|
.sort();
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -10,6 +10,7 @@ import { fireEvent } from "../../common/dom/fire_event";
|
|||||||
import { PersitentNotificationEntity } from "../../data/persistent_notification";
|
import { PersitentNotificationEntity } from "../../data/persistent_notification";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import "./notification-item-template";
|
import "./notification-item-template";
|
||||||
|
import { domainToName } from "../../data/integration";
|
||||||
|
|
||||||
@customElement("configurator-notification-item")
|
@customElement("configurator-notification-item")
|
||||||
export class HuiConfiguratorNotificationItem extends LitElement {
|
export class HuiConfiguratorNotificationItem extends LitElement {
|
||||||
@ -24,7 +25,9 @@ export class HuiConfiguratorNotificationItem extends LitElement {
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<notification-item-template>
|
<notification-item-template>
|
||||||
<span slot="header">${this.hass.localize("domain.configurator")}</span>
|
<span slot="header">
|
||||||
|
${domainToName(this.hass.localize, "configurator")}
|
||||||
|
</span>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
|
@ -27,6 +27,7 @@ import { PolymerChangedEvent } from "../../../../polymer-types";
|
|||||||
import { haStyleDialog } from "../../../../resources/styles";
|
import { haStyleDialog } from "../../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
import { Placeholder, PlaceholderContainer } from "./dialog-thingtalk";
|
import { Placeholder, PlaceholderContainer } from "./dialog-thingtalk";
|
||||||
|
import { domainToName } from "../../../../data/integration";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// for fire event
|
// for fire event
|
||||||
@ -320,7 +321,7 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
private _getLabel(domains: string[], deviceClasses?: string[]) {
|
private _getLabel(domains: string[], deviceClasses?: string[]) {
|
||||||
return `${domains
|
return `${domains
|
||||||
.map((domain) => this.hass.localize(`domain.${domain}`))
|
.map((domain) => domainToName(this.hass.localize, domain))
|
||||||
.join(", ")}${
|
.join(", ")}${
|
||||||
deviceClasses ? ` of type ${deviceClasses.join(", ")}` : ""
|
deviceClasses ? ` of type ${deviceClasses.join(", ")}` : ""
|
||||||
}`;
|
}`;
|
||||||
@ -410,7 +411,7 @@ export class ThingTalkPlaceholders extends SubscribeMixin(LitElement) {
|
|||||||
if (entities.length === 0) {
|
if (entities.length === 0) {
|
||||||
// Should not happen because we filter the device picker on domain
|
// Should not happen because we filter the device picker on domain
|
||||||
this._error = `No ${placeholder.domains
|
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.`;
|
.join(", ")} entities found in this device.`;
|
||||||
} else if (entities.length === 1) {
|
} else if (entities.length === 1) {
|
||||||
applyPatch(
|
applyPatch(
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
integrationIssuesUrl,
|
integrationIssuesUrl,
|
||||||
IntegrationManifest,
|
IntegrationManifest,
|
||||||
fetchIntegrationManifests,
|
fetchIntegrationManifests,
|
||||||
|
domainToName,
|
||||||
} from "../../../data/integration";
|
} from "../../../data/integration";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ class IntegrationsCard extends LitElement {
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="name">
|
<td class="name">
|
||||||
${manifest?.name}<br />
|
${domainToName(this.hass.localize, domain)}<br />
|
||||||
<span class="domain">${domain}</span>
|
<span class="domain">${domain}</span>
|
||||||
</td>
|
</td>
|
||||||
${!manifest
|
${!manifest
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
SystemHealthInfo,
|
SystemHealthInfo,
|
||||||
} from "../../../data/system_health";
|
} from "../../../data/system_health";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
import { domainToName } from "../../../data/integration";
|
||||||
|
|
||||||
const sortKeys = (a: string, b: string) => {
|
const sortKeys = (a: string, b: string) => {
|
||||||
if (a === "homeassistant") {
|
if (a === "homeassistant") {
|
||||||
@ -64,7 +65,7 @@ class SystemHealthCard extends LitElement {
|
|||||||
}
|
}
|
||||||
if (domain !== "homeassistant") {
|
if (domain !== "homeassistant") {
|
||||||
sections.push(
|
sections.push(
|
||||||
html` <h3>${this.hass.localize(`domain.${domain}`) || domain}</h3> `
|
html` <h3>${domainToName(this.hass.localize, domain)}</h3> `
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
sections.push(html`
|
sections.push(html`
|
||||||
@ -76,7 +77,7 @@ class SystemHealthCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card .header=${this.hass.localize("domain.system_health")}>
|
<ha-card .header=${domainToName(this.hass.localize, "system_health")}>
|
||||||
<div class="card-content">${sections}</div>
|
<div class="card-content">${sections}</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
`;
|
`;
|
||||||
|
@ -73,10 +73,7 @@ class DialogSystemLogDetail extends LitElement {
|
|||||||
${integration
|
${integration
|
||||||
? html`
|
? html`
|
||||||
<br />
|
<br />
|
||||||
Integration:
|
Integration: ${domainToName(this.hass.localize, integration)}
|
||||||
${this._manifest
|
|
||||||
? this._manifest.name
|
|
||||||
: domainToName(this.hass.localize, integration)}
|
|
||||||
${!this._manifest ||
|
${!this._manifest ||
|
||||||
// Can happen with custom integrations
|
// Can happen with custom integrations
|
||||||
!this._manifest.documentation
|
!this._manifest.documentation
|
||||||
|
@ -41,6 +41,7 @@ import {
|
|||||||
} from "../cards/types";
|
} from "../cards/types";
|
||||||
import { processEditorEntities } from "../editor/process-editor-entities";
|
import { processEditorEntities } from "../editor/process-editor-entities";
|
||||||
import { LovelaceRowConfig, WeblinkConfig } from "../entity-rows/types";
|
import { LovelaceRowConfig, WeblinkConfig } from "../entity-rows/types";
|
||||||
|
import { domainToName } from "../../../data/integration";
|
||||||
|
|
||||||
const DEFAULT_VIEW_ENTITY_ID = "group.default_view";
|
const DEFAULT_VIEW_ENTITY_ID = "group.default_view";
|
||||||
const DOMAINS_BADGES = [
|
const DOMAINS_BADGES = [
|
||||||
@ -301,7 +302,7 @@ const generateViewConfig = (
|
|||||||
entities[entityId],
|
entities[entityId],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
title: localize(`domain.${domain}`),
|
title: domainToName(localize, domain),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -25,6 +25,7 @@ import { loadLovelaceResources } from "./common/load-resources";
|
|||||||
import { showSaveDialog } from "./editor/show-save-config-dialog";
|
import { showSaveDialog } from "./editor/show-save-config-dialog";
|
||||||
import "./hui-root";
|
import "./hui-root";
|
||||||
import { Lovelace } from "./types";
|
import { Lovelace } from "./types";
|
||||||
|
import { domainToName } from "../../data/integration";
|
||||||
|
|
||||||
(window as any).loadCardHelpers = () => import("./custom-card-helpers");
|
(window as any).loadCardHelpers = () => import("./custom-card-helpers");
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ class LovelacePanel extends LitElement {
|
|||||||
if (state === "error") {
|
if (state === "error") {
|
||||||
return html`
|
return html`
|
||||||
<hass-error-screen
|
<hass-error-screen
|
||||||
title="${this.hass!.localize("domain.lovelace")}"
|
title="${domainToName(this.hass!.localize, "lovelace")}"
|
||||||
.error="${this._errorMsg}"
|
.error="${this._errorMsg}"
|
||||||
>
|
>
|
||||||
<mwc-button raised @click=${this._forceFetchConfig}>
|
<mwc-button raised @click=${this._forceFetchConfig}>
|
||||||
|
@ -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": {
|
"panel": {
|
||||||
"calendar": "Calendar",
|
"calendar": "Calendar",
|
||||||
"config": "Configuration",
|
"config": "Configuration",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user