mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 01:46:35 +00:00
L10N config-entries (#1718)
* L10N config-entries * Lint * Address review comment * Add back parentheses
This commit is contained in:
parent
70225c1a18
commit
c91b28a850
@ -19,7 +19,7 @@ function computeEntityName(hass, entity) {
|
||||
/*
|
||||
* @appliesMixin EventsMixin
|
||||
*/
|
||||
class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
class HaCeEntitiesCard extends EventsMixin(PolymerElement) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style>
|
||||
@ -63,7 +63,8 @@ class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
_computeEntityName(entity, hass) {
|
||||
return computeEntityName(hass, entity) || '(entity unavailable)';
|
||||
return computeEntityName(hass, entity)
|
||||
|| `(${this.localize('ui.panel.config.integrations.config_entry.entity_unavailable')})`;
|
||||
}
|
||||
|
||||
_openMoreInfo(ev) {
|
||||
@ -71,4 +72,4 @@ class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('ha-ce-entities-card', HaDeviceCard);
|
||||
customElements.define('ha-ce-entities-card', HaCeEntitiesCard);
|
||||
|
@ -50,17 +50,19 @@ class HaConfigManagerDashboard extends
|
||||
}
|
||||
</style>
|
||||
|
||||
<hass-subpage header="Integrations">
|
||||
<hass-subpage header="[[localize('ui.panel.config.integrations.caption')]]">
|
||||
<template is="dom-if" if="[[progress.length]]">
|
||||
<ha-config-section>
|
||||
<span slot="header">Discovered</span>
|
||||
<span slot="header">[[localize('ui.panel.config.integrations.discovered')]]</span>
|
||||
<paper-card>
|
||||
<template is="dom-repeat" items="[[progress]]">
|
||||
<div class="config-entry-row">
|
||||
<paper-item-body>
|
||||
[[_computeIntegrationTitle(localize, item.handler)]]
|
||||
</paper-item-body>
|
||||
<paper-button on-click="_continueFlow">Configure</paper-button>
|
||||
<paper-button
|
||||
on-click="_continueFlow"
|
||||
>[[localize('ui.panel.config.integrations.configure')]]</paper-button>
|
||||
</div>
|
||||
</template>
|
||||
</paper-card>
|
||||
@ -68,12 +70,12 @@ class HaConfigManagerDashboard extends
|
||||
</template>
|
||||
|
||||
<ha-config-section class='configured'>
|
||||
<span slot="header">Configured</span>
|
||||
<span slot="header">[[localize('ui.panel.config.integrations.configured')]]</span>
|
||||
<paper-card>
|
||||
<template is="dom-if" if="[[!entries.length]]">
|
||||
<div class="config-entry-row">
|
||||
<paper-item-body two-line>
|
||||
<div>Nothing configured yet</div>
|
||||
<div>[[localize('ui.panel.config.integrations.none')]]</div>
|
||||
</paper-item-body>
|
||||
</div>
|
||||
</template>
|
||||
@ -99,14 +101,16 @@ class HaConfigManagerDashboard extends
|
||||
</ha-config-section>
|
||||
|
||||
<ha-config-section>
|
||||
<span slot="header">Set up a new integration</span>
|
||||
<span slot="header">[[localize('ui.panel.config.integrations.new')]]</span>
|
||||
<paper-card>
|
||||
<template is="dom-repeat" items="[[handlers]]">
|
||||
<div class="config-entry-row">
|
||||
<paper-item-body>
|
||||
[[_computeIntegrationTitle(localize, item)]]
|
||||
</paper-item-body>
|
||||
<paper-button on-click="_createFlow">Configure</paper-button>
|
||||
<paper-button
|
||||
on-click="_createFlow"
|
||||
>[[localize('ui.panel.config.integrations.configure')]]</paper-button>
|
||||
</div>
|
||||
</template>
|
||||
</paper-card>
|
||||
|
@ -10,9 +10,10 @@ import compare from '../../../common/string/compare.js';
|
||||
import './ha-device-card.js';
|
||||
import './ha-ce-entities-card.js';
|
||||
import EventsMixin from '../../../mixins/events-mixin.js';
|
||||
import LocalizeMixin from '../../../mixins/localize-mixin.js';
|
||||
import NavigateMixin from '../../../mixins/navigate-mixin.js';
|
||||
|
||||
class HaConfigEntryPage extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
class HaConfigEntryPage extends NavigateMixin(EventsMixin(LocalizeMixin(PolymerElement))) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style>
|
||||
@ -44,7 +45,7 @@ class HaConfigEntryPage extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
></paper-icon-button>
|
||||
<div class='content'>
|
||||
<template is='dom-if' if='[[_computeIsEmpty(_configEntryDevices, _noDeviceEntities)]]'>
|
||||
<p>This integration has no devices.</p>
|
||||
<p>[[localize('ui.panel.config.integrations.config_entry.no_devices')]]</p>
|
||||
</template>
|
||||
<template is='dom-repeat' items='[[_configEntryDevices]]' as='device'>
|
||||
<ha-device-card
|
||||
@ -56,7 +57,7 @@ class HaConfigEntryPage extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
</template>
|
||||
<template is='dom-if' if='[[_noDeviceEntities.length]]'>
|
||||
<ha-ce-entities-card
|
||||
heading='Entities without devices'
|
||||
heading="[[localize('ui.panel.config.integrations.config_entry.no_device')]]"
|
||||
entities='[[_noDeviceEntities]]'
|
||||
hass='[[hass]]'
|
||||
></ha-ce-entities-card>
|
||||
@ -124,7 +125,7 @@ class HaConfigEntryPage extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
}
|
||||
|
||||
_removeEntry() {
|
||||
if (!confirm('Are you sure you want to delete this integration?')) return;
|
||||
if (!confirm(this.localize('ui.panel.config.integrations.config_entry.delete_confirm'))) return;
|
||||
|
||||
const entryId = this.configEntry.entry_id;
|
||||
|
||||
@ -132,7 +133,7 @@ class HaConfigEntryPage extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
.then((result) => {
|
||||
this.fire('hass-reload-entries');
|
||||
if (result.require_restart) {
|
||||
alert('Restart Home Assistant to finish removing this integration');
|
||||
alert(this.localize('ui.panel.config.integrations.config_entry.restart_confirm'));
|
||||
}
|
||||
this.navigate('/config/integrations/dashboard', true);
|
||||
});
|
||||
|
@ -7,6 +7,7 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||
import '../../../layouts/hass-subpage.js';
|
||||
|
||||
import EventsMixin from '../../../mixins/events-mixin.js';
|
||||
import LocalizeMixin from '../../../mixins/localize-mixin.js';
|
||||
import computeStateName from '../../../common/entity/compute_state_name.js';
|
||||
import '../../../components/entity/state-badge.js';
|
||||
import compare from '../../../common/string/compare.js';
|
||||
@ -20,7 +21,7 @@ function computeEntityName(hass, entity) {
|
||||
/*
|
||||
* @appliesMixin EventsMixin
|
||||
*/
|
||||
class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
class HaDeviceCard extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style>
|
||||
@ -61,17 +62,19 @@ class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
<!-- <h1>[[configEntry.title]] ([[_computeIntegrationTitle(localize, configEntry.domain)]])</h1> -->
|
||||
<div class='info'>
|
||||
<div class='model'>[[device.model]]</div>
|
||||
<div class='manuf'>by [[device.manufacturer]]</div>
|
||||
<div class='manuf'>
|
||||
[[localize('ui.panel.config.integrations.config_entry.manuf', 'manufacturer', device.manufacturer)]]
|
||||
</div>
|
||||
</div>
|
||||
<template is='dom-if' if='[[device.hub_device_id]]'>
|
||||
<div class='extra-info'>
|
||||
Connected via
|
||||
[[localize('ui.panel.config.integrations.config_entry.hub')]]
|
||||
<span class='hub'>[[_computeDeviceName(devices, device.hub_device_id)]]</span>
|
||||
</div>
|
||||
</template>
|
||||
<template is='dom-if' if='[[device.sw_version]]'>
|
||||
<div class='extra-info'>
|
||||
Firmware: [[device.sw_version]]
|
||||
[[localize('ui.panel.config.integrations.config_entry.firmware', 'version', device.sw_version)]]
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@ -126,12 +129,14 @@ class HaDeviceCard extends EventsMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
_computeEntityName(entity, hass) {
|
||||
return computeEntityName(hass, entity) || '(entity unavailable)';
|
||||
return computeEntityName(hass, entity)
|
||||
|| `(${this.localize('ui.panel.config.integrations.config_entry.entity_unavailable')})`;
|
||||
}
|
||||
|
||||
_computeDeviceName(devices, deviceId) {
|
||||
const device = devices.find(dev => dev.id === deviceId);
|
||||
return device ? device.name : '(device unavailable)';
|
||||
return device ? device.name
|
||||
: `(${this.localize('ui.panel.config.integrations.config_entry.device_unavailable')})`;
|
||||
}
|
||||
|
||||
_openMoreInfo(ev) {
|
||||
|
@ -40,7 +40,7 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
|
||||
<app-header slot="header" fixed="">
|
||||
<app-toolbar>
|
||||
<ha-menu-button narrow="[[narrow]]" show-menu="[[showMenu]]"></ha-menu-button>
|
||||
<div main-title="">[[localize('panel.configuration')]]</div>
|
||||
<div main-title="">[[localize('panel.config')]]</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
|
||||
@ -54,12 +54,16 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
|
||||
<a href='/config/cloud' tabindex="-1">
|
||||
<paper-item on-click="_navigate">
|
||||
<paper-item-body two-line="">
|
||||
Home Assistant Cloud
|
||||
[[localize('ui.panel.config.cloud.caption')]]
|
||||
<template is="dom-if" if="[[cloudStatus.logged_in]]">
|
||||
<div secondary="">Logged in as [[cloudStatus.email]]</div>
|
||||
<div secondary="">
|
||||
[[localize('ui.panel.config.cloud.description_login', 'email', cloudStatus.email)]]
|
||||
</div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[!cloudStatus.logged_in]]">
|
||||
<div secondary="">Not logged in</div>
|
||||
<div secondary="">
|
||||
[[localize('ui.panel.config.cloud.description_not_login')]]
|
||||
</div>
|
||||
</template>
|
||||
</paper-item-body>
|
||||
<iron-icon icon="hass:chevron-right"></iron-icon>
|
||||
@ -72,8 +76,10 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
|
||||
<a href='/config/integrations/dashboard' tabindex="-1">
|
||||
<paper-item>
|
||||
<paper-item-body two-line>
|
||||
Integrations
|
||||
<div secondary>Manage connected devices and services</div>
|
||||
[[localize('ui.panel.config.integrations.caption')]]
|
||||
<div secondary>
|
||||
[[localize('ui.panel.config.integrations.description')]]
|
||||
</div>
|
||||
</paper-item-body>
|
||||
<iron-icon icon="hass:chevron-right"></iron-icon>
|
||||
</paper-item>
|
||||
|
@ -697,6 +697,31 @@
|
||||
"caption": "Script",
|
||||
"description": "Create and edit scripts"
|
||||
},
|
||||
"cloud": {
|
||||
"caption": "Home Assistant Cloud",
|
||||
"description_login": "Logged in as {email}",
|
||||
"description_not_login": "Not logged in"
|
||||
},
|
||||
"integrations": {
|
||||
"caption": "Integrations",
|
||||
"description": "Manage connected devices and services",
|
||||
"discovered": "Discovered",
|
||||
"configured": "Configured",
|
||||
"new": "Set up a new integration",
|
||||
"configure": "Configure",
|
||||
"none": "Nothing configured yet",
|
||||
"config_entry": {
|
||||
"no_devices": "This integration has no devices.",
|
||||
"no_device": "Entities without devices",
|
||||
"delete_confirm": "Are you sure you want to delete this integration?",
|
||||
"restart_confirm": "Restart Home Assistant to finish removing this integration",
|
||||
"manuf": "by {manufacturer}",
|
||||
"hub": "Connected via",
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "device unavailable",
|
||||
"entity_unavailable": "entity unavailable"
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"caption": "Users",
|
||||
"description": "Manage users",
|
||||
|
Loading…
x
Reference in New Issue
Block a user