Make dashboard entries translatable (#10831)

This commit is contained in:
Joakim Sørensen 2021-12-09 18:59:27 +01:00 committed by GitHub
parent faccb12430
commit 149f381bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 27 deletions

View File

@ -43,8 +43,7 @@ class HaConfigNavigation extends LitElement {
<paper-item-body two-line> <paper-item-body two-line>
${page.name || ${page.name ||
this.hass.localize( this.hass.localize(
page.translationKey || `ui.panel.config.dashboard.${page.translationKey}.title`
`ui.panel.config.${page.component}.caption`
)} )}
${page.component === "cloud" && (page.info as CloudStatus) ${page.component === "cloud" && (page.info as CloudStatus)
? page.info.logged_in ? page.info.logged_in
@ -68,7 +67,7 @@ class HaConfigNavigation extends LitElement {
<div secondary> <div secondary>
${page.description || ${page.description ||
this.hass.localize( this.hass.localize(
`ui.panel.config.${page.component}.description` `ui.panel.config.dashboard.${page.translationKey}.description`
)} )}
</div> </div>
`} `}

View File

@ -49,80 +49,69 @@ export const configSections: { [name: string]: PageNavigation[] } = {
dashboard: [ dashboard: [
{ {
path: "/config/integrations", path: "/config/integrations",
name: "Devices & Services", translationKey: "devices",
description: "Integrations, devices, entities and areas",
iconPath: mdiDevices, iconPath: mdiDevices,
iconColor: "#0D47A1", iconColor: "#0D47A1",
core: true, core: true,
}, },
{ {
path: "/config/automation", path: "/config/automation",
name: "Automations & Scenes", translationKey: "automations",
description: "Manage automations, scenes, scripts and helpers",
iconPath: mdiRobot, iconPath: mdiRobot,
iconColor: "#518C43", iconColor: "#518C43",
core: true, core: true,
}, },
{ {
path: "/config/blueprint", path: "/config/blueprint",
name: "Blueprints", translationKey: "blueprints",
description: "Manage blueprints",
iconPath: mdiPaletteSwatch, iconPath: mdiPaletteSwatch,
iconColor: "#64B5F6", iconColor: "#64B5F6",
component: "blueprint", component: "blueprint",
}, },
{ {
path: "/hassio", path: "/hassio",
name: "Add-ons, Backups & Supervisor", translationKey: "supervisor",
description: "Create backups, check logs or reboot your system",
iconPath: mdiHomeAssistant, iconPath: mdiHomeAssistant,
iconColor: "#4084CD", iconColor: "#4084CD",
component: "hassio", component: "hassio",
}, },
{ {
path: "/config/lovelace/dashboards", path: "/config/lovelace/dashboards",
name: "Dashboards", translationKey: "dashboards",
description: "Create customized sets of cards to control your home",
iconPath: mdiViewDashboard, iconPath: mdiViewDashboard,
iconColor: "#B1345C", iconColor: "#B1345C",
component: "lovelace", component: "lovelace",
}, },
{ {
path: "/config/energy", path: "/config/energy",
name: "Energy", translationKey: "energy",
description: "Monitor your energy production and consumption",
iconPath: mdiLightningBolt, iconPath: mdiLightningBolt,
iconColor: "#F1C447", iconColor: "#F1C447",
component: "energy", component: "energy",
}, },
{ {
path: "/config/tags", path: "/config/tags",
name: "Tags", translationKey: "tags",
description:
"Trigger automations when a NFC tag, QR code, etc. is scanned",
iconPath: mdiNfcVariant, iconPath: mdiNfcVariant,
iconColor: "#616161", iconColor: "#616161",
component: "tag", component: "tag",
}, },
{ {
path: "/config/person", path: "/config/person",
name: "People & Zones", translationKey: "people",
description: "Manage the people and zones that Home Assistant tracks",
iconPath: mdiAccount, iconPath: mdiAccount,
iconColor: "#E48629", iconColor: "#E48629",
components: ["person", "zone", "users"], components: ["person", "zone", "users"],
}, },
{ {
path: "#external-app-configuration", path: "#external-app-configuration",
name: "Companion App", translationKey: "companion",
description: "Location and notifications",
iconPath: mdiCellphoneCog, iconPath: mdiCellphoneCog,
iconColor: "#8E24AA", iconColor: "#8E24AA",
}, },
{ {
path: "/config/core", path: "/config/core",
name: "Settings", translationKey: "settings",
description: "Basic settings, server controls, logs and info",
iconPath: mdiCog, iconPath: mdiCog,
iconColor: "#4A5963", iconColor: "#4A5963",
core: true, core: true,

View File

@ -928,9 +928,47 @@
}, },
"config": { "config": {
"header": "Configure Home Assistant", "header": "Configure Home Assistant",
"advanced_mode": { "dashboard": {
"hint_enable": "Missing config options? Enable advanced mode on", "devices": {
"link_profile_page": "your profile page" "title": "Devices & Services",
"description": "Integrations, devices, entities and areas"
},
"automations": {
"title": "Automations & Scenes",
"description": "Manage automations, scenes, scripts and helpers"
},
"blueprints": {
"title": "Blueprints",
"description": "Manage blueprints"
},
"supervisor": {
"title": "Add-ons, Backups & Supervisor",
"description": "Create backups, check logs or reboot your system"
},
"dashboards": {
"title": "Dashboards",
"description": "Create customized sets of cards to control your home"
},
"energy": {
"title": "Energy",
"description": "Monitor your energy production and consumption"
},
"tags": {
"title": "Tags",
"description": "Trigger automations when a NFC tag, QR code, etc. is scanned"
},
"people": {
"title": "People & Zones",
"description": "Manage the people and zones that Home Assistant tracks"
},
"companion": {
"title": "Companion App",
"description": "Location and notifications"
},
"settings": {
"title": "Settings",
"description": "Basic settings, server controls, logs and info"
}
}, },
"common": { "common": {
"editor": { "editor": {