Move ZHA config panel section translations to backend (#9018)

This commit is contained in:
David F. Mulcahey 2021-04-30 12:59:06 -04:00 committed by GitHub
parent 92b32458ad
commit ce2743a982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 10 deletions

View File

@ -25,6 +25,7 @@ export type TranslationCategory =
| "title"
| "state"
| "config"
| "config_panel"
| "options"
| "device_automation"
| "mfa_setup"

View File

@ -63,6 +63,7 @@ class ZHAConfigDashboard extends LitElement {
protected firstUpdated(changedProperties: PropertyValues): void {
super.firstUpdated(changedProperties);
if (this.hass) {
this.hass.loadBackendTranslation("config_panel", "zha", false);
this._fetchConfiguration();
}
}
@ -108,7 +109,7 @@ class ZHAConfigDashboard extends LitElement {
? Object.entries(this._configuration.schemas).map(
([section, schema]) => html` <ha-card
header=${this.hass.localize(
`ui.panel.config.zha.configuration_page.${section}.title`
`component.zha.config_panel.${section}.title`
)}
>
<div class="card-content">
@ -164,9 +165,8 @@ class ZHAConfigDashboard extends LitElement {
private _computeLabelCallback(localize, section: string) {
// Returns a callback for ha-form to calculate labels per schema object
return (schema) =>
localize(
`ui.panel.config.zha.configuration_page.${section}.${schema.name}`
) || schema.name;
localize(`component.zha.config_panel.${section}.${schema.name}`) ||
schema.name;
}
static get styles(): CSSResultArray {

View File

@ -2382,12 +2382,7 @@
},
"configuration_page": {
"shortcuts_title": "Shortcuts",
"update_button": "Update Configuration",
"zha_options": {
"title": "Global Options",
"enable_identify_on_join": "Enable identify effect when devices join the network",
"default_light_transition": "Default light transition time (seconds)"
}
"update_button": "Update Configuration"
},
"add_device_page": {
"spinner": "Searching for ZHA Zigbee devices...",