Update where we load integration titles from (#5546)

This commit is contained in:
Paulus Schoutsen 2020-04-15 11:47:29 -07:00 committed by GitHub
parent fc7771ec13
commit ba0cba1a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 22 deletions

View File

@ -98,7 +98,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
href="/config/integrations/config_entry/${relatedConfigEntryId}" href="/config/integrations/config_entry/${relatedConfigEntryId}"
@click=${this._close} @click=${this._close}
> >
${this.hass.localize(`component.${entry.domain}.config.title`)}: ${this.hass.localize(`component.${entry.domain}.title`)}:
${entry.title} ${entry.title}
</a> </a>
`; `;

View File

@ -75,7 +75,7 @@ export const localizeConfigFlowTitle = (
const placeholders = flow.context.title_placeholders || {}; const placeholders = flow.context.title_placeholders || {};
const placeholderKeys = Object.keys(placeholders); const placeholderKeys = Object.keys(placeholders);
if (placeholderKeys.length === 0) { if (placeholderKeys.length === 0) {
return localize(`component.${flow.handler}.config.title`); return localize(`component.${flow.handler}.title`);
} }
const args: string[] = []; const args: string[] = [];
placeholderKeys.forEach((key) => { placeholderKeys.forEach((key) => {

View File

@ -66,7 +66,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
"ui.dialogs.config_entry_system_options.title", "ui.dialogs.config_entry_system_options.title",
"integration", "integration",
this.hass.localize( this.hass.localize(
`component.${this._params.entry.domain}.config.title` `component.${this._params.entry.domain}.title`
) || this._params.entry.domain ) || this._params.entry.domain
)} )}
</h2> </h2>
@ -98,7 +98,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
"ui.dialogs.config_entry_system_options.enable_new_entities_description", "ui.dialogs.config_entry_system_options.enable_new_entities_description",
"integration", "integration",
this.hass.localize( this.hass.localize(
`component.${this._params.entry.domain}.config.title` `component.${this._params.entry.domain}.title`
) || this._params.entry.domain ) || this._params.entry.domain
)} )}
</p> </p>

View File

@ -26,8 +26,8 @@ export const showConfigFlowDialog = (
getConfigFlowHandlers(hass).then((handlers) => getConfigFlowHandlers(hass).then((handlers) =>
handlers.sort((handlerA, handlerB) => handlers.sort((handlerA, handlerB) =>
caseInsensitiveCompare( caseInsensitiveCompare(
hass.localize(`component.${handlerA}.config.title`), hass.localize(`component.${handlerA}.title`),
hass.localize(`component.${handlerB}.config.title`) hass.localize(`component.${handlerB}.title`)
) )
) )
), ),

View File

@ -43,8 +43,7 @@ class StepFlowPickHandler extends LitElement {
private _getHandlers = memoizeOne((h: string[], filter?: string) => { private _getHandlers = memoizeOne((h: string[], filter?: string) => {
const handlers: HandlerObj[] = h.map((handler) => { const handlers: HandlerObj[] = h.map((handler) => {
return { return {
name: name: this.hass.localize(`component.${handler}.title`) || handler,
this.hass.localize(`component.${handler}.config.title`) || handler,
slug: handler, slug: handler,
}; };
}); });

View File

@ -62,9 +62,7 @@ class OnboardingIntegrations extends LitElement {
// Render discovered and existing entries together sorted by localized title. // Render discovered and existing entries together sorted by localized title.
const entries: Array<[string, TemplateResult]> = this._entries.map( const entries: Array<[string, TemplateResult]> = this._entries.map(
(entry) => { (entry) => {
const title = this.hass.localize( const title = this.hass.localize(`component.${entry.domain}.title`);
`component.${entry.domain}.config.title`
);
return [ return [
title, title,
html` html`

View File

@ -115,9 +115,8 @@ export class HaConfigDeviceDashboard extends LitElement {
.filter((entId) => entId in entryLookup) .filter((entId) => entId in entryLookup)
.map( .map(
(entId) => (entId) =>
localize( localize(`component.${entryLookup[entId].domain}.title`) ||
`component.${entryLookup[entId].domain}.config.title` entryLookup[entId].domain
) || entryLookup[entId].domain
) )
.join(", ") .join(", ")
: "No integration", : "No integration",

View File

@ -116,9 +116,8 @@ export class HaDevicesDataTable extends LitElement {
.filter((entId) => entId in entryLookup) .filter((entId) => entId in entryLookup)
.map( .map(
(entId) => (entId) =>
localize( localize(`component.${entryLookup[entId].domain}.title`) ||
`component.${entryLookup[entId].domain}.config.title` entryLookup[entId].domain
) || entryLookup[entId].domain
) )
.join(", ") .join(", ")
: "No integration", : "No integration",

View File

@ -166,7 +166,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
return html` return html`
${name}<br /> ${name}<br />
${entity.entity_id} | ${entity.entity_id} |
${this.hass.localize(`component.${entity.platform}.config.title`) || ${this.hass.localize(`component.${entity.platform}.title`) ||
entity.platform} entity.platform}
`; `;
}; };
@ -190,7 +190,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
filterable: true, filterable: true,
width: "20%", width: "20%",
template: (platform) => template: (platform) =>
this.hass.localize(`component.${platform}.config.title`) || platform, this.hass.localize(`component.${platform}.title`) || platform,
}; };
columns.status = statusColumn; columns.status = statusColumn;

View File

@ -126,7 +126,7 @@ export class HaConfigManagerDashboard extends LitElement {
<paper-item> <paper-item>
<paper-item-body> <paper-item-body>
${this.hass.localize( ${this.hass.localize(
`component.${item.domain}.config.title` `component.${item.domain}.title`
)} )}
</paper-item-body> </paper-item-body>
<paper-icon-button <paper-icon-button
@ -210,7 +210,7 @@ export class HaConfigManagerDashboard extends LitElement {
<paper-item-body two-line> <paper-item-body two-line>
<div> <div>
${this.hass.localize( ${this.hass.localize(
`component.${item.domain}.config.title` `component.${item.domain}.title`
)}: )}:
${item.title} ${item.title}
</div> </div>
@ -311,7 +311,7 @@ export class HaConfigManagerDashboard extends LitElement {
title: this.hass!.localize( title: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_delete_ignore_title", "ui.panel.config.integrations.ignore.confirm_delete_ignore_title",
"name", "name",
this.hass.localize(`component.${entry.domain}.config.title`) this.hass.localize(`component.${entry.domain}.title`)
), ),
text: this.hass!.localize( text: this.hass!.localize(
"ui.panel.config.integrations.ignore.confirm_delete_ignore" "ui.panel.config.integrations.ignore.confirm_delete_ignore"