From 93a1adaa569724f9cf2a7a6627babc60d4b2a305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 27 Apr 2021 22:44:28 +0200 Subject: [PATCH] Remove analytics translations (#9002) --- src/components/ha-analytics-learn-more.ts | 5 +- src/components/ha-analytics.ts | 76 ++++++++----------- src/onboarding/onboarding-analytics.ts | 10 +-- src/panels/config/core/ha-config-analytics.ts | 16 +--- src/translations/en.json | 28 ------- 5 files changed, 40 insertions(+), 95 deletions(-) diff --git a/src/components/ha-analytics-learn-more.ts b/src/components/ha-analytics-learn-more.ts index 8b7c756efa..75acdab0b5 100644 --- a/src/components/ha-analytics-learn-more.ts +++ b/src/components/ha-analytics-learn-more.ts @@ -6,5 +6,6 @@ export const analyticsLearnMore = (hass: HomeAssistant) => html`${hass.localize("ui.panel.config.core.section.core.analytics.learn_more")}`; +> + How we process your data +`; diff --git a/src/components/ha-analytics.ts b/src/components/ha-analytics.ts index 6cf9d37b07..f6d40fe356 100644 --- a/src/components/ha-analytics.ts +++ b/src/components/ha-analytics.ts @@ -8,7 +8,6 @@ import { property, TemplateResult, } from "lit-element"; -import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { Analytics, AnalyticsPreferences } from "../data/analytics"; import { haStyle } from "../resources/styles"; @@ -17,7 +16,18 @@ import "./ha-checkbox"; import type { HaCheckbox } from "./ha-checkbox"; import "./ha-settings-row"; -const ADDITIONAL_PREFERENCES = ["usage", "statistics"]; +const ADDITIONAL_PREFERENCES = [ + { + key: "usage", + title: "Usage", + description: "Details of what you use with Home Assistant", + }, + { + key: "statistics", + title: "Statistical data", + description: "Counts containing total number of datapoints", + }, +]; declare global { interface HASSDomEvents { @@ -48,14 +58,10 @@ export class HaAnalytics extends LitElement { - ${this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.base.title` - )} + Basic analytics - ${this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.base.description` - )} + This includes information about your system. ${ADDITIONAL_PREFERENCES.map( @@ -64,44 +70,23 @@ export class HaAnalytics extends LitElement { ${!baseEnabled - ? html`${this.hass.localize( - "ui.panel.config.core.section.core.analytics.needs_base" - )} + ? html` + You need to enable basic analytics for this option to be + available ` : ""} - - ${preference === "usage" - ? isComponentLoaded(this.hass, "hassio") - ? this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.usage_supervisor.title` - ) - : this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.usage.title` - ) - : this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.${preference}.title` - )} + + ${preference.title} - - ${preference !== "usage" - ? this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.${preference}.description` - ) - : isComponentLoaded(this.hass, "hassio") - ? this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.usage_supervisor.description` - ) - : this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.usage.description` - )} + + ${preference.description} ` )} @@ -117,14 +102,10 @@ export class HaAnalytics extends LitElement { - ${this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.diagnostics.title` - )} + Diagnostics - ${this.hass.localize( - `ui.panel.config.core.section.core.analytics.preference.diagnostics.description` - )} + Share crash reports when unexpected errors occur. `; @@ -161,7 +142,10 @@ export class HaAnalytics extends LitElement { preferences[preference] = checkbox.checked; - if (ADDITIONAL_PREFERENCES.includes(preference) && checkbox.checked) { + if ( + ADDITIONAL_PREFERENCES.some((entry) => entry.key === preference) && + checkbox.checked + ) { preferences.base = true; } else if (preference === "base" && !checkbox.checked) { preferences.usage = false; diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index d8615b2408..78c20b485f 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -32,13 +32,9 @@ class OnboardingAnalytics extends LitElement { protected render(): TemplateResult { return html`

- ${this.hass.localize( - "ui.panel.config.core.section.core.analytics.introduction", - "link", - html`analytics.home-assistant.io` - )} + Share anonymized information from your installation to help make Home + Assistant better and help us convince manufacturers to add local control + and privacy-focused features.

+
${error ? html`
${error}
` : ""}

- ${this.hass.localize( - "ui.panel.config.core.section.core.analytics.introduction", - "link", - html`analytics.home-assistant.io` - )} + Share anonymized information from your installation to help make + Home Assistant better and help us convince manufacturers to add + local control and privacy-focused features.