Make cloud account panel translatable (#3875)

* Add localization to cloud login & register (#3844)

* Add localization to cloud account (#3844)

* Add localization to cloud forgot password (#3844)

* fix lint errors

* Update src/panels/config/cloud/account/cloud-account.js

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/cloud/register/cloud-register.js

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* fix issues pointed out in review

* fix code style issue

* Add localization for dialogs, alexa and google

* fix exposed entities name
This commit is contained in:
Sven 2019-10-04 13:14:53 +02:00 committed by Bram Kragten
parent 4850f3d588
commit d4d897e79e
13 changed files with 492 additions and 159 deletions

View File

@ -63,19 +63,21 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
color: var(--primary-color);
}
</style>
<hass-subpage header="Home Assistant Cloud">
<hass-subpage header="[[localize('ui.panel.config.cloud.caption')]]">
<div class="content">
<ha-config-section is-wide="[[isWide]]">
<span slot="header">Home Assistant Cloud</span>
<span slot="header"
>[[localize('ui.panel.config.cloud.caption')]]</span
>
<div slot="introduction">
<p>
Thank you for being part of Home Assistant Cloud. It's because
of people like you that we are able to make a great home
automation experience for everyone. Thank you!
[[localize('ui.panel.config.cloud.account.thank_you_note')]]
</p>
</div>
<ha-card header="Nabu Casa Account">
<ha-card
header="[[localize('ui.panel.config.cloud.account.nabu_casa_account')]]"
>
<div class="account-row">
<paper-item-body two-line="">
[[cloudStatus.email]]
@ -86,33 +88,37 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
</div>
<div class="account-row">
<paper-item-body> Cloud connection status </paper-item-body>
<paper-item-body
>[[localize('ui.panel.config.cloud.account.connection_status')]]</paper-item-body
>
<div class="status">[[cloudStatus.cloud]]</div>
</div>
<div class="card-actions">
<a href="https://account.nabucasa.com" target="_blank"
><mwc-button>Manage Account</mwc-button></a
><mwc-button
>[[localize('ui.panel.config.cloud.account.manage_account')]]</mwc-button
></a
>
<mwc-button style="float: right" on-click="handleLogout"
>Sign out</mwc-button
>[[localize('ui.panel.config.cloud.account.sign_out')]]</mwc-button
>
</div>
</ha-card>
</ha-config-section>
<ha-config-section is-wide="[[isWide]]">
<span slot="header">Integrations</span>
<span slot="header"
>[[localize('ui.panel.config.cloud.account.integrations')]]</span
>
<div slot="introduction">
<p>
Integrations for Home Assistant Cloud allow you to connect with
services in the cloud without having to expose your Home
Assistant instance publicly on the internet.
[[localize('ui.panel.config.cloud.account.integrations_introduction')]]
</p>
<p>
Check the website for
[[localize('ui.panel.config.cloud.account.integrations_introduction2')]]
<a href="https://www.nabucasa.com" target="_blank"
>all available features</a
>[[localize('ui.panel.config.cloud.account.integrations_link_all_features')]]</a
>.
</p>
</div>
@ -160,7 +166,9 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
}
_computeRemoteConnected(connected) {
return connected ? "Connected" : "Not Connected";
return connected
? this.hass.localize("ui.panel.config.cloud.account.connected")
: this.hass.localize("ui.panel.config.cloud.account.not_connected");
}
async _fetchSubscriptionInfo() {
@ -182,7 +190,9 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
_formatSubscription(subInfo) {
if (subInfo === null) {
return "Fetching subscription…";
return this.hass.localize(
"ui.panel.config.cloud.account.fetching_subscription"
);
}
let description = subInfo.human_description;

View File

@ -31,7 +31,11 @@ export class CloudAlexaPref extends LitElement {
const { alexa_enabled, alexa_report_state } = this.cloudStatus!.prefs;
return html`
<ha-card header="Alexa">
<ha-card
header=${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.title"
)}
>
<div class="switch">
<ha-switch
.checked=${alexa_enabled}
@ -39,15 +43,16 @@ export class CloudAlexaPref extends LitElement {
></ha-switch>
</div>
<div class="card-content">
With the Alexa integration for Home Assistant Cloud you'll be able to
control all your Home Assistant devices via any Alexa-enabled device.
${this.hass!.localize("ui.panel.config.cloud.account.alexa.info")}
<ul>
<li>
<a
href="https://skills-store.amazon.com/deeplink/dp/B0772J1QKB?deviceType=app"
target="_blank"
>
Enable the Home Assistant skill for Alexa
${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.enable_ha_skill"
)}
</a>
</li>
<li>
@ -55,22 +60,28 @@ export class CloudAlexaPref extends LitElement {
href="https://www.nabucasa.com/config/amazon_alexa/"
target="_blank"
>
Config documentation
${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.config_documentation"
)}
</a>
</li>
</ul>
<em
>This integration requires an Alexa-enabled device like the Amazon
Echo.</em
>${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.requirements"
)}</em
>
${alexa_enabled
? html`
<h3>Enable State Reporting</h3>
<h3>
${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.enable_state_reporting"
)}
</h3>
<p>
If you enable state reporting, Home Assistant will send
<b>all</b> state changes of exposed entities to Amazon. This
allows you to always see the latest states in the Alexa app
and use the state changes to create routines.
${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.info_state_reporting"
)}
</p>
<ha-switch
.checked=${alexa_report_state}
@ -81,11 +92,17 @@ export class CloudAlexaPref extends LitElement {
</div>
<div class="card-actions">
<mwc-button @click=${this._handleSync} .disabled=${this._syncing}>
Sync Entities
${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.sync_entities"
)}
</mwc-button>
<div class="spacer"></div>
<a href="/config/cloud/alexa">
<mwc-button>Manage Entities</mwc-button>
<mwc-button
>${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.manage_entities"
)}</mwc-button
>
</a>
</div>
</ha-card>
@ -97,7 +114,11 @@ export class CloudAlexaPref extends LitElement {
try {
await syncCloudAlexaEntities(this.hass!);
} catch (err) {
alert(`Failed to sync entities: ${err.body.message}`);
alert(
`${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.sync_entities_error"
)} ${err.body.message}`
);
} finally {
this._syncing = false;
}
@ -122,9 +143,15 @@ export class CloudAlexaPref extends LitElement {
fireEvent(this, "ha-refresh-cloud-status");
} catch (err) {
alert(
`Unable to ${toggle.checked ? "enable" : "disable"} report state. ${
err.message
}`
`${this.hass!.localize(
"ui.panel.config.cloud.account.alexa.state_reporting_error",
"enable_disable",
this.hass!.localize(
toggle.checked
? "ui.panel.config.cloud.account.alexa.enable"
: "ui.panel.config.cloud.account.alexa.disable"
)
)} ${err.message}`
);
toggle.checked = !toggle.checked;
}

View File

@ -42,7 +42,11 @@ export class CloudGooglePref extends LitElement {
} = this.cloudStatus.prefs;
return html`
<ha-card header="Google Assistant">
<ha-card
header=${this.hass!.localize(
"ui.panel.config.cloud.account.google.title"
)}
>
<div class="switch">
<ha-switch
id="google_enabled"
@ -51,16 +55,16 @@ export class CloudGooglePref extends LitElement {
></ha-switch>
</div>
<div class="card-content">
With the Google Assistant integration for Home Assistant Cloud you'll
be able to control all your Home Assistant devices via any Google
Assistant-enabled device.
${this.hass!.localize("ui.panel.config.cloud.account.google.info")}
<ul>
<li>
<a
href="https://assistant.google.com/services/a/uid/00000091fd5fb875?hl=en-US"
target="_blank"
>
Activate the Home Assistant skill for Google Assistant
${this.hass!.localize(
"ui.panel.config.cloud.account.google.enable_ha_skill"
)}
</a>
</li>
<li>
@ -68,25 +72,31 @@ export class CloudGooglePref extends LitElement {
href="https://www.nabucasa.com/config/google_assistant/"
target="_blank"
>
Config documentation
${this.hass!.localize(
"ui.panel.config.cloud.account.google.config_documentation"
)}
</a>
</li>
</ul>
<em
>This integration requires a Google Assistant-enabled device like
the Google Home or Android phone.</em
>${this.hass!.localize(
"ui.panel.config.cloud.account.google.requirements"
)}</em
>
${google_enabled
? html`
<div class="secure_devices">
Please enter a pin to interact with security devices. Security
devices are doors, garage doors and locks. You will be asked
to say/enter this pin when interacting with such devices via
Google Assistant.
${this.hass!.localize(
"ui.panel.config.cloud.account.google.enter_pin_info"
)}
<paper-input
label="Secure Devices Pin"
label="${this.hass!.localize(
"ui.panel.config.cloud.account.google.devices_pin"
)}"
id="google_secure_devices_pin"
placeholder="Enter a PIN to use secure devices"
placeholder="${this.hass!.localize(
"ui.panel.config.cloud.account.google.enter_pin_hint"
)}"
.value=${google_secure_devices_pin || ""}
@change="${this._pinChanged}"
></paper-input>
@ -100,11 +110,17 @@ export class CloudGooglePref extends LitElement {
.disabled="${!google_enabled}"
path="cloud/google_actions/sync"
>
Sync entities to Google
${this.hass!.localize(
"ui.panel.config.cloud.account.google.sync_entities"
)}
</ha-call-api-button>
<div class="spacer"></div>
<a href="/config/cloud/google-assistant">
<mwc-button>Manage Entities</mwc-button>
<mwc-button
>${this.hass!.localize(
"ui.panel.config.cloud.account.google.manage_entities"
)}</mwc-button
>
</a>
</div>
</ha-card>
@ -130,7 +146,11 @@ export class CloudGooglePref extends LitElement {
showSaveSuccessToast(this, this.hass!);
fireEvent(this, "ha-refresh-cloud-status");
} catch (err) {
alert(`Unable to store pin: ${err.message}`);
alert(
`${this.hass!.localize(
"ui.panel.config.cloud.account.google.enter_pin_error"
)} ${err.message}`
);
input.value = this.cloudStatus!.prefs.google_secure_devices_pin;
}
}

View File

@ -49,16 +49,26 @@ export class CloudRemotePref extends LitElement {
if (!remote_certificate) {
return html`
<ha-card header="Remote Control">
<ha-card
header=${this.hass!.localize(
"ui.panel.config.cloud.account.remote.title"
)}
>
<div class="preparing">
Remote access is being prepared. We will notify you when it's ready.
${this.hass!.localize(
"ui.panel.config.cloud.account.remote.access_is_being_prepared"
)}
</div>
</ha-card>
`;
}
return html`
<ha-card header="Remote Control">
<ha-card
header=${this.hass!.localize(
"ui.panel.config.cloud.account.remote.title"
)}
>
<div class="switch">
<ha-switch
.checked="${remote_connected}"
@ -66,22 +76,33 @@ export class CloudRemotePref extends LitElement {
></ha-switch>
</div>
<div class="card-content">
Home Assistant Cloud provides a secure remote connection to your
instance while away from home. Your instance
${remote_connected ? "is" : "will be"} available at
${this.hass!.localize("ui.panel.config.cloud.account.remote.info")}
${remote_connected
? this.hass!.localize(
"ui.panel.config.cloud.account.remote.instance_is_available"
)
: this.hass!.localize(
"ui.panel.config.cloud.account.remote.instance_will_be_available"
)}
<a href="https://${remote_domain}" target="_blank">
https://${remote_domain}</a
>.
</div>
<div class="card-actions">
<a href="https://www.nabucasa.com/config/remote/" target="_blank">
<mwc-button>Learn how it works</mwc-button>
<mwc-button
>${this.hass!.localize(
"ui.panel.config.cloud.account.remote.link_learn_how_it_works"
)}</mwc-button
>
</a>
${remote_certificate
? html`
<div class="spacer"></div>
<mwc-button @click=${this._openCertInfo}>
Certificate Info
${this.hass!.localize(
"ui.panel.config.cloud.account.remote.certificate_info"
)}
</mwc-button>
`
: ""}

View File

@ -51,16 +51,20 @@ export class CloudWebhooks extends LitElement {
protected render() {
return html`
${this.renderStyle()}
<ha-card header="Webhooks">
<ha-card
header=${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.title"
)}
>
<div class="card-content">
Anything that is configured to be triggered by a webhook can be given
a publicly accessible URL to allow you to send data back to Home
Assistant from anywhere, without exposing your instance to the
internet. ${this._renderBody()}
${this.hass!.localize("ui.panel.config.cloud.account.webhooks.info")}
${this._renderBody()}
<div class="footer">
<a href="https://www.nabucasa.com/config/webhooks" target="_blank">
Learn more about creating webhook-powered automations.
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.link_learn_more"
)}
</a>
</div>
</div>
@ -78,16 +82,33 @@ export class CloudWebhooks extends LitElement {
private _renderBody() {
if (!this.cloudStatus || !this._localHooks || !this._cloudHooks) {
return html`
<div class="body-text">Loading</div>
<div class="body-text">
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.loading"
)}
</div>
`;
}
if (this._localHooks.length === 0) {
return html`
<div class="body-text">
Looks like you have no webhooks yet. Get started by configuring a
<a href="/config/integrations">webhook-based integration</a> or by
creating a <a href="/config/automation/new">webhook automation</a>.
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet"
)}
<a href="/config/integrations"
>${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_integration"
)}</a
>
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet2"
)}
<a href="/config/automation/new"
>${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_automation"
)}</a
>.
</div>
`;
}
@ -113,7 +134,9 @@ export class CloudWebhooks extends LitElement {
: this._cloudHooks![entry.webhook_id]
? html`
<mwc-button @click="${this._handleManageButton}">
Manage
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.manage"
)}
</mwc-button>
`
: html`
@ -171,7 +194,11 @@ export class CloudWebhooks extends LitElement {
try {
await deleteCloudhook(this.hass!, webhookId!);
} catch (err) {
alert(`Failed to disable webhook: ${(err as WebhookError).message}`);
alert(
`${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.disable_hook_error_msg"
)} ${(err as WebhookError).message}`
);
return;
} finally {
this._progress = this._progress.filter((wid) => wid !== webhookId);

View File

@ -136,7 +136,7 @@ class CloudAlexa extends LitElement {
.checked=${isExposed}
@change=${this._exposeChanged}
>
Expose to Alexa
${this.hass!.localize("ui.panel.config.cloud.alexa.expose")}
</ha-switch>
</div>
</ha-card>
@ -148,7 +148,9 @@ class CloudAlexa extends LitElement {
}
return html`
<hass-subpage header="Alexa">
<hass-subpage header="${this.hass!.localize(
"ui.panel.config.cloud.alexa.title"
)}">
<span slot="toolbar-icon">
${selected}${
!this.narrow
@ -173,9 +175,7 @@ class CloudAlexa extends LitElement {
!emptyFilter
? html`
<div class="banner">
Editing which entities are exposed via this UI is disabled
because you have configured entity filters in
configuration.yaml.
${this.hass!.localize("ui.panel.config.cloud.alexa.banner")}
</div>
`
: ""
@ -183,7 +183,11 @@ class CloudAlexa extends LitElement {
${
exposedCards.length > 0
? html`
<h1>Exposed entities</h1>
<h1>
${this.hass!.localize(
"ui.panel.config.cloud.alexa.exposed_entities"
)}
</h1>
<div class="content">${exposedCards}</div>
`
: ""
@ -191,7 +195,11 @@ class CloudAlexa extends LitElement {
${
notExposedCards.length > 0
? html`
<h1>Not Exposed entities</h1>
<h1>
${this.hass!.localize(
"ui.panel.config.cloud.alexa.not_exposed_entities"
)}
</h1>
<div class="content">${notExposedCards}</div>
`
: ""

View File

@ -40,23 +40,38 @@ class DialogCloudCertificate extends LitElement {
return html`
<ha-paper-dialog with-backdrop>
<h2>Certificate Information</h2>
<h2>
${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.certificate_information"
)}
</h2>
<div>
<p>
Certificate expiration date:
${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.certificate_expiration_date"
)}
${format_date_time(
new Date(certificateInfo.expire_date),
this.hass!.language
)}<br />
(Will be automatically renewed)
(${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.will_be_auto_renewed"
)})
</p>
<p>
Certificate fingerprint: ${certificateInfo.fingerprint}
${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.fingerprint"
)}
${certificateInfo.fingerprint}
</p>
</div>
<div class="paper-dialog-buttons">
<mwc-button @click="${this._closeDialog}">CLOSE</mwc-button>
<mwc-button @click="${this._closeDialog}"
>${this.hass!.localize(
"ui.panel.config.cloud.dialog_certificate.close"
)}</mwc-button
>
</div>
</ha-paper-dialog>
`;

View File

@ -50,9 +50,19 @@ export class DialogManageCloudhook extends LitElement {
: `https://www.home-assistant.io/integrations/${webhook.domain}/`;
return html`
<ha-paper-dialog with-backdrop>
<h2>Webhook for ${webhook.name}</h2>
<h2>
${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.webhook_for",
"name",
webhook.name
)}
</h2>
<div>
<p>The webhook is available at the following url:</p>
<p>
${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.available_at"
)}
</p>
<paper-input
label="${inputLabel}"
value="${cloudhook.cloudhook_url}"
@ -62,13 +72,18 @@ export class DialogManageCloudhook extends LitElement {
<p>
${cloudhook.managed
? html`
This webhook is managed by an integration and cannot be
disabled.
${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.managed_by_integration"
)}
`
: html`
If you no longer want to use this webhook, you can
${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.info_disable_webhook"
)}
<button class="link" @click="${this._disableWebhook}">
disable it</button
${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.link_disable_webhook"
)}</button
>.
`}
</p>
@ -76,9 +91,17 @@ export class DialogManageCloudhook extends LitElement {
<div class="paper-dialog-buttons">
<a href="${docsUrl}" target="_blank">
<mwc-button>VIEW DOCUMENTATION</mwc-button>
<mwc-button
>${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.view_documentation"
)}</mwc-button
>
</a>
<mwc-button @click="${this._closeDialog}">CLOSE</mwc-button>
<mwc-button @click="${this._closeDialog}"
>${this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.close"
)}</mwc-button
>
</div>
</ha-paper-dialog>
`;
@ -97,7 +120,13 @@ export class DialogManageCloudhook extends LitElement {
}
private async _disableWebhook() {
if (!confirm("Are you sure you want to disable this webhook?")) {
if (
!confirm(
this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.confirm_disable"
)
)
) {
return;
}
@ -113,7 +142,9 @@ export class DialogManageCloudhook extends LitElement {
input.setSelectionRange(0, input.value.length);
try {
document.execCommand("copy");
paperInput.label = "COPIED TO CLIPBOARD";
paperInput.label = this.hass!.localize(
"ui.panel.config.cloud.dialog_cloudhook.copied_to_clipboard"
);
} catch (err) {
// Copying failed. Oh no
}

View File

@ -7,11 +7,12 @@ import "../../../../components/buttons/ha-progress-button";
import "../../../../layouts/hass-subpage";
import "../../../../resources/ha-style";
import { EventsMixin } from "../../../../mixins/events-mixin";
import LocalizeMixin from "../../../../mixins/localize-mixin";
/*
* @appliesMixin EventsMixin
* @appliesMixin LocalizeMixin
*/
class CloudForgotPassword extends EventsMixin(PolymerElement) {
class CloudForgotPassword extends LocalizeMixin(EventsMixin(PolymerElement)) {
static get template() {
return html`
<style include="iron-flex ha-style">
@ -44,30 +45,29 @@ class CloudForgotPassword extends EventsMixin(PolymerElement) {
display: none;
}
</style>
<hass-subpage header="Forgot Password">
<hass-subpage header=[[localize('ui.panel.config.cloud.forgot_password.title')]]>
<div class="content">
<ha-card header="Forgot your password">
<ha-card header=[[localize('ui.panel.config.cloud.forgot_password.subtitle')]]>
<div class="card-content">
<p>
Enter your email address and we will send you a link to reset
your password.
[[localize('ui.panel.config.cloud.forgot_password.instructions')]]
</p>
<div class="error" hidden$="[[!_error]]">[[_error]]</div>
<paper-input
autofocus=""
id="email"
label="E-mail"
label="[[localize('ui.panel.config.cloud.forgot_password.email')]]"
value="{{email}}"
type="email"
on-keydown="_keyDown"
error-message="Invalid email"
error-message="[[localize('ui.panel.config.cloud.forgot_password.email_error_msg')]]"
></paper-input>
</div>
<div class="card-actions">
<ha-progress-button
on-click="_handleEmailPasswordReset"
progress="[[_requestInProgress]]"
>Send reset email</ha-progress-button
>[[localize('ui.panel.config.cloud.forgot_password.send_reset_email')]]</ha-progress-button
>
</div>
</ha-card>
@ -126,7 +126,7 @@ class CloudForgotPassword extends EventsMixin(PolymerElement) {
this._requestInProgress = false;
this.fire("cloud-done", {
flashMessage:
"Check your email for instructions on how to reset your password.",
"[[localize('ui.panel.config.cloud.forgot_password.check_your_email')]]",
});
},
(err) =>

View File

@ -132,7 +132,7 @@ class CloudGoogleAssistant extends LitElement {
.checked=${isExposed}
@change=${this._exposeChanged}
>
Expose to Google Assistant
${this.hass!.localize("ui.panel.config.cloud.google.expose")}
</ha-switch>
${entity.might_2fa
? html`
@ -141,7 +141,9 @@ class CloudGoogleAssistant extends LitElement {
.checked=${Boolean(config.disable_2fa)}
@change=${this._disable2FAChanged}
>
Disable two factor authentication
${this.hass!.localize(
"ui.panel.config.cloud.google.disable_2FA"
)}
</ha-switch>
`
: ""}
@ -155,7 +157,9 @@ class CloudGoogleAssistant extends LitElement {
}
return html`
<hass-subpage header="Google Assistant">
<hass-subpage header="${this.hass!.localize(
"ui.panel.config.cloud.google.title"
)}">
<span slot="toolbar-icon">
${selected}${
!this.narrow
@ -180,9 +184,7 @@ class CloudGoogleAssistant extends LitElement {
!emptyFilter
? html`
<div class="banner">
Editing which entities are exposed via this UI is disabled
because you have configured entity filters in
configuration.yaml.
${this.hass!.localize("ui.panel.config.cloud.google.banner")}
</div>
`
: ""
@ -190,7 +192,11 @@ class CloudGoogleAssistant extends LitElement {
${
exposedCards.length > 0
? html`
<h1>Exposed entities</h1>
<h1>
${this.hass!.localize(
"ui.panel.config.cloud.google.exposed_entities"
)}
</h1>
<div class="content">${exposedCards}</div>
`
: ""
@ -198,7 +204,11 @@ class CloudGoogleAssistant extends LitElement {
${
notExposedCards.length > 0
? html`
<h1>Not Exposed entities</h1>
<h1>
${this.hass!.localize(
"ui.panel.config.cloud.google.not_exposed_entities"
)}
</h1>
<div class="content">${notExposedCards}</div>
`
: ""
@ -323,7 +333,11 @@ class CloudGoogleAssistant extends LitElement {
window.addEventListener(
"popstate",
() => {
showToast(parent, { message: "Synchronizing changes to Google." });
showToast(parent, {
message: this.hass!.localize(
"ui.panel.config.cloud.googe.sync_to_google"
),
});
cloudSyncGoogleAssistant(this.hass);
},
{ once: true }

View File

@ -16,11 +16,15 @@ import "../../ha-config-section";
import { EventsMixin } from "../../../../mixins/events-mixin";
import NavigateMixin from "../../../../mixins/navigate-mixin";
import "../../../../components/ha-icon-next";
import LocalizeMixin from "../../../../mixins/localize-mixin";
/*
* @appliesMixin NavigateMixin
* @appliesMixin EventsMixin
* @appliesMixin LocalizeMixin
*/
class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
class CloudLogin extends LocalizeMixin(
NavigateMixin(EventsMixin(PolymerElement))
) {
static get template() {
return html`
<style include="iron-flex ha-style">
@ -68,31 +72,29 @@ class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
color: var(--secondary-text-color);
}
</style>
<hass-subpage header="Cloud Login">
<hass-subpage header="[[localize('ui.panel.config.cloud.caption')]]">
<div class="content">
<ha-config-section is-wide="[[isWide]]">
<span slot="header">Home Assistant Cloud</span>
<span slot="header"
>[[localize('ui.panel.config.cloud.caption')]]</span
>
<div slot="introduction">
<p>
Home Assistant Cloud provides you with a secure remote
connection to your instance while away from home. It also allows
you to connect with cloud-only services: Amazon Alexa and Google
Assistant.
[[localize('ui.panel.config.cloud.login.introduction')]]
</p>
<p>
This service is run by our partner
[[localize('ui.panel.config.cloud.login.introduction2')]]
<a href="https://www.nabucasa.com" target="_blank"
>Nabu&nbsp;Casa,&nbsp;Inc</a
>, a company founded by the founders of Home Assistant and
Hass.io.
>
[[localize('ui.panel.config.cloud.login.introduction2a')]]
</p>
<p>
Home Assistant Cloud is a subscription service with a free one
month trial. No payment information necessary.
[[localize('ui.panel.config.cloud.login.introduction3')]]
</p>
<p>
<a href="https://www.nabucasa.com" target="_blank"
>Learn more about Home Assistant Cloud</a
>[[localize('ui.panel.config.cloud.login.learn_more_link')]]</a
>
</p>
</div>
@ -101,44 +103,46 @@ class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
<div class="card-content flash-msg">
[[flashMessage]]
<paper-icon-button icon="hass:close" on-click="_dismissFlash"
>Dismiss</paper-icon-button
>[[localize('ui.panel.config.cloud.login.dismiss')]]</paper-icon-button
>
<paper-ripple id="flashRipple" noink=""></paper-ripple>
</div>
</ha-card>
<ha-card header="Sign in">
<ha-card
header="[[localize('ui.panel.config.cloud.login.sign_in')]]"
>
<div class="card-content">
<div class="error" hidden$="[[!_error]]">[[_error]]</div>
<paper-input
label="Email"
label="[[localize('ui.panel.config.cloud.login.email')]]"
id="email"
type="email"
value="{{email}}"
on-keydown="_keyDown"
error-message="Invalid email"
error-message="[[localize('ui.panel.config.cloud.login.email_error_msg')]]"
></paper-input>
<paper-input
id="password"
label="Password"
label="[[localize('ui.panel.config.cloud.login.password')]]"
value="{{_password}}"
type="password"
on-keydown="_keyDown"
error-message="Passwords are at least 8 characters"
error-message="[[localize('ui.panel.config.cloud.login.password_error_msg')]]"
></paper-input>
</div>
<div class="card-actions">
<ha-progress-button
on-click="_handleLogin"
progress="[[_requestInProgress]]"
>Sign in</ha-progress-button
>[[localize('ui.panel.config.cloud.login.sign_in')]]</ha-progress-button
>
<button
class="link"
hidden="[[_requestInProgress]]"
on-click="_handleForgotPassword"
>
forgot password?
[[localize('ui.panel.config.cloud.login.forgot_password')]]
</button>
</div>
</ha-card>
@ -146,8 +150,10 @@ class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
<ha-card>
<paper-item on-click="_handleRegister">
<paper-item-body two-line="">
Start your free 1 month trial
<div secondary="">No payment information necessary</div>
[[localize('ui.panel.config.cloud.login.start_trial')]]
<div secondary="">
[[localize('ui.panel.config.cloud.login.trial_info')]]
</div>
</paper-item-body>
<ha-icon-next></ha-icon-next>
</paper-item>
@ -251,7 +257,9 @@ class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
const errCode = err && err.body && err.body.code;
if (errCode === "PasswordChangeRequired") {
alert("You need to change your password before logging in.");
alert(
"[[localize('ui.panel.config.cloud.login.alert_password_change_required')]]"
);
this.navigate("/config/cloud/forgot-password");
return;
}
@ -265,7 +273,8 @@ class CloudLogin extends NavigateMixin(EventsMixin(PolymerElement)) {
};
if (errCode === "UserNotConfirmed") {
props._error = "You need to confirm your email before logging in.";
props._error =
"[[localize('ui.panel.config.cloud.login.alert_email_confirm_necessary')]]";
}
this.setProperties(props);

View File

@ -8,11 +8,13 @@ import "../../../../layouts/hass-subpage";
import "../../../../resources/ha-style";
import "../../ha-config-section";
import { EventsMixin } from "../../../../mixins/events-mixin";
import LocalizeMixin from "../../../../mixins/localize-mixin";
/*
* @appliesMixin EventsMixin
* @appliesMixin LocalizeMixin
*/
class CloudRegister extends EventsMixin(PolymerElement) {
class CloudRegister extends LocalizeMixin(EventsMixin(PolymerElement)) {
static get template() {
return html`
<style include="iron-flex ha-style">
@ -48,47 +50,47 @@ class CloudRegister extends EventsMixin(PolymerElement) {
display: none;
}
</style>
<hass-subpage header="Register Account">
<hass-subpage header="[[localize('ui.panel.config.cloud.register.title')]]">
<div class="content">
<ha-config-section is-wide="[[isWide]]">
<span slot="header">Start your free trial</span>
<span slot="header">[[localize('ui.panel.config.cloud.register.headline')]]</span>
<div slot="introduction">
<p>
Create an account to start your free one month trial with Home Assistant Cloud. No payment information necessary.
[[localize('ui.panel.config.cloud.register.information')]]
</p>
<p>
The trial will give you access to all the benefits of Home Assistant Cloud, including:
[[localize('ui.panel.config.cloud.register.information2')]]
</p>
<ul>
<li>Control of Home Assistant away from home</li>
<li>Integration with Google Assistant</li>
<li>Integration with Amazon Alexa</li>
<li>Easy integration with webhook-based apps like OwnTracks</li>
<li>[[localize('ui.panel.config.cloud.register.feature_remote_control')]]</li>
<li>[[localize('ui.panel.config.cloud.register.feature_google_home')]]</li>
<li>[[localize('ui.panel.config.cloud.register.feature_amazon_alexa')]]</li>
<li>[[localize('ui.panel.config.cloud.register.feature_webhook_apps')]]</li>
</ul>
<p>
This service is run by our partner <a href='https://www.nabucasa.com' target='_blank'>Nabu&nbsp;Casa,&nbsp;Inc</a>, a company founded by the founders of Home Assistant and Hass.io.
[[localize('ui.panel.config.cloud.register.information3')]] <a href='https://www.nabucasa.com' target='_blank'>Nabu&nbsp;Casa,&nbsp;Inc</a>[[localize('ui.panel.config.cloud.register.information3a')]]
</p>
<p>
By registering an account you agree to the following terms and conditions.
[[localize('ui.panel.config.cloud.register.information4')]]
</p><ul>
<li><a href="https://home-assistant.io/tos/" target="_blank">Terms and Conditions</a></li>
<li><a href="https://home-assistant.io/privacy/" target="_blank">Privacy Policy</a></li>
<li><a href="https://home-assistant.io/tos/" target="_blank">[[localize('ui.panel.config.cloud.register.link_terms_conditions')]]</a></li>
<li><a href="https://home-assistant.io/privacy/" target="_blank">[[localize('ui.panel.config.cloud.register.link_privacy_policy')]]</a></li>
</ul>
</p>
</div>
<ha-card header="Create Account">
<ha-card header="[[localize('ui.panel.config.cloud.register.create_account')]]">
<div class="card-content">
<div class="header">
<div class="error" hidden$="[[!_error]]">[[_error]]</div>
</div>
<paper-input autofocus="" id="email" label="Email address" type="email" value="{{email}}" on-keydown="_keyDown" error-message="Invalid email"></paper-input>
<paper-input id="password" label="Password" value="{{_password}}" type="password" on-keydown="_keyDown" error-message="Your password needs to be at least 8 characters"></paper-input>
<paper-input autofocus="" id="email" label="[[localize('ui.panel.config.cloud.register.email_address')]]" type="email" value="{{email}}" on-keydown="_keyDown" error-message="[[localize('ui.panel.config.cloud.register.email_error_msg')]]"></paper-input>
<paper-input id="password" label="Password" value="{{_password}}" type="password" on-keydown="_keyDown" error-message="[[localize('ui.panel.config.cloud.register.password_error_msg')]]"></paper-input>
</div>
<div class="card-actions">
<ha-progress-button on-click="_handleRegister" progress="[[_requestInProgress]]">Start trial</ha-progress-button>
<button class="link" hidden="[[_requestInProgress]]" on-click="_handleResendVerifyEmail">Resend confirmation email</button>
<ha-progress-button on-click="_handleRegister" progress="[[_requestInProgress]]">[[localize('ui.panel.config.cloud.register.start_trial')]]</ha-progress-button>
<button class="link" hidden="[[_requestInProgress]]" on-click="_handleResendVerifyEmail">[[localize('ui.panel.config.cloud.register.resend_confirmation_email')]]</button>
</div>
</ha-card>
</ha-config-section>
@ -211,8 +213,9 @@ class CloudRegister extends EventsMixin(PolymerElement) {
_password: "",
});
this.fire("cloud-done", {
flashMessage:
"Account created! Check your email for instructions on how to activate your account.",
flashMessage: this.hass.localize(
"ui.panel.config.cloud.register.account_created"
),
});
}
}

View File

@ -916,7 +916,155 @@
"caption": "Home Assistant Cloud",
"description_login": "Logged in as {email}",
"description_not_login": "Not logged in",
"description_features": "Control away from home, integrate with Alexa and Google Assistant."
"description_features": "Control away from home, integrate with Alexa and Google Assistant.",
"login": {
"title": "Cloud Login",
"introduction": "Home Assistant Cloud provides you with a secure remote connection to your instance while away from home. It also allows you to connect with cloud-only services: Amazon Alexa and Google Assistant.",
"introduction2": "This service is run by our partner ",
"introduction2a": ", a company founded by the founders of Home Assistant and Hass.io.",
"introduction3": "Home Assistant Cloud is a subscription service with a free one month trial. No payment information necessary.",
"learn_more_link": "Learn more about Home Assistant Cloud",
"dismiss": "Dismiss",
"sign_in": "Sign in",
"email": "Email",
"email_error_msg": "Invalid email",
"password": "Password",
"password_error_msg": "Passwords are at least 8 characters",
"forgot_password": "forgot password?",
"start_trial": "Start your free 1 month trial",
"trial_info": "No payment information necessary",
"alert_password_change_required": "You need to change your password before logging in.",
"alert_email_confirm_necessary": "You need to confirm your email before logging in."
},
"forgot_password": {
"title": "Forgot password",
"subtitle": "Forgot your password",
"instructions": "Enter your email address and we will send you a link to reset your password.",
"email": "Email",
"email_error_msg": "Invalid email",
"send_reset_email": "Send reset email",
"check_your_email": "Check your email for instructions on how to reset your password."
},
"register": {
"title": "Register Account",
"headline": "Start your free trial",
"information": "Create an account to start your free one month trial with Home Assistant Cloud. No payment information necessary.",
"information2": "The trial will give you access to all the benefits of Home Assistant Cloud, including:",
"feature_remote_control": "Control of Home Assistant away from home",
"feature_google_home": "Integration with Google Assistant",
"feature_amazon_alexa": "Integration with Amazon Alexa",
"feature_webhook_apps": "Easy integration with webhook-based apps like OwnTracks",
"information3": "This service is run by our partner ",
"information3a": ", a company founded by the founders of Home Assistant and Hass.io.",
"information4": "By registering an account you agree to the following terms and conditions.",
"link_terms_conditions": "Terms and Conditions",
"link_privacy_policy": "Privacy Policy",
"create_account": "Create Account",
"email_address": "Email address",
"email_error_msg": "Invalid email",
"password": "Password",
"password_error_msg": "Passwords are at least 8 characters",
"start_trial": "Start Trial",
"resend_confirm_email": "Resend confirmation email",
"account_created": "Account created! Check your email for instructions on how to activate your account."
},
"account": {
"thank_you_note": "Thank you for being part of Home Assistant Cloud. It's because of people like you that we are able to make a great home automation experience for everyone. Thank you!",
"nabu_casa_account": "Nabu Casa Account",
"connection_status": "Cloud connection status",
"manage_account": "Manage Account",
"sign_out": "Sign out",
"integrations": "Integrations",
"integrations_introduction": "Integrations for Home Assistant Cloud allow you to connect with services in the cloud without having to expose your Home Assistant instance publicly on the internet.",
"integrations_introduction2": "Check the website for ",
"integrations_link_all_features": " all available features",
"connected": "Connected",
"not_connected": "Not Connected",
"fetching_subscription": "Fetching subscription…",
"remote": {
"title": "Remote Control",
"access_is_being_prepared": "Remote access is being prepared. We will notify you when it's ready.",
"info": "Home Assistant Cloud provides a secure remote connection to your instance while away from home.",
"instance_is_available": "Your instance is available at",
"instance_will_be_available": "Your instance will be available at",
"link_learn_how_it_works": "Learn how it works",
"certificate_info": "Certificate Info"
},
"alexa": {
"title": "Alexa",
"info": "With the Alexa integration for Home Assistant Cloud you'll be able to control all your Home Assistant devices via any Alexa-enabled device.",
"enable_ha_skill": "Enable the Home Assistant skill for Alexa",
"config_documentation": "Config documentation",
"requirements": "This integration requires an Alexa-enabled device like the Amazon Echo.",
"enable_state_reporting": "Enable State Reporting",
"info_state_reporting": "If you enable state reporting, Home Assistant will send all state changes of exposed entities to Amazon. This allows you to always see the latest states in the Alexa app and use the state changes to create routines.",
"sync_entities": "Sync Entities",
"manage_entities": "Manage Entities",
"sync_entities_error": "Failed to sync entities:",
"state_reporting_error": "Unable to {enable_disable} report state.",
"enable": "enable",
"disable": "disable"
},
"google": {
"title": "Google Assistant",
"info": "With the Google Assistant integration for Home Assistant Cloud you'll be able to control all your Home Assistant devices via any Google Assistant-enabled device.",
"enable_ha_skill": "Activate the Home Assistant skill for Google Assistant",
"config_documentation": "Config documentation",
"requirements": "This integration requires a Google Assistant-enabled device like the Google Home or Android phone.",
"enter_pin_info": "Please enter a pin to interact with security devices. Security devices are doors, garage doors and locks. You will be asked to say/enter this pin when interacting with such devices via Google Assistant.",
"devices_pin": "Secure Devices Pin",
"enter_pin_hint": "Enter a PIN to use secure devices",
"sync_entities": "Sync Entities to Google",
"manage_entities": "Manage Entities",
"enter_pin_error": "Unable to store pin:"
},
"webhooks": {
"title": "Webhooks",
"info": "Anything that is configured to be triggered by a webhook can be given a publicly accessible URL to allow you to send data back to Home Assistant from anywhere, without exposing your instance to the internet.",
"no_hooks_yet": "Looks like you have no webhooks yet. Get started by configuring a ",
"no_hooks_yet_link_integration": "webhook-based integration",
"no_hooks_yet2": " or by creating a ",
"no_hooks_yet_link_automation": "webhook automation",
"link_learn_more": "Learn more about creating webhook-powered automations.",
"loading": "Loading ...",
"manage": "Manage",
"disable_hook_error_msg": "Failed to disable webhook:"
}
},
"alexa": {
"title": "Alexa",
"banner": "Editing which entities are exposed via this UI is disabled because you have configured entity filters in configuration.yaml.",
"exposed_entities": "Exposed entities",
"not_exposed_entities": "Not Exposed entities",
"expose": "Expose to Alexa"
},
"dialog_certificate": {
"certificate_information": "Certificate Information",
"certificate_expiration_date": "Certificate expiration date",
"will_be_auto_renewed": "Will be automatically renewed",
"fingerprint": "Certificate fingerprint:",
"close": "Close"
},
"google": {
"title": "Google Assistant",
"expose": "Expose to Google Assistant",
"disable_2FA": "Disable two factor authentication",
"banner": "Editing which entities are exposed via this UI is disabled because you have configured entity filters in configuration.yaml.",
"exposed_entities": "Exposed entities",
"not_exposed_entities": "Not Exposed entities",
"sync_to_google": "Synchronizing changes to Google."
},
"dialog_cloudhook": {
"webhook_for": "Webhook for {name}",
"available_at": "The webhook is available at the following url:",
"managed_by_integration": "This webhook is managed by an integration and cannot be disabled.",
"info_disable_webhook": "If you no longer want to use this webhook, you can",
"link_disable_webhook": "disable it",
"view_documentation": "View documentation",
"close": "Close",
"confirm_disable": "Are you sure you want to disable this webhook?",
"copied_to_clipboard": "Copied to clipboard"
}
},
"devices": {
"caption": "Devices",