From 26e914290dccc014594136964411c528cd3a8953 Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:33:45 +0100 Subject: [PATCH] Fix hassio logs translations (#22693) Co-authored-by: Bram Kragten --- .../addon-view/log/hassio-addon-log-tab.ts | 3 +- src/panels/config/logs/error-log-card.ts | 76 +++++++++---------- src/translations/en.json | 56 ++++++++++++++ 3 files changed, 92 insertions(+), 43 deletions(-) diff --git a/hassio/src/addon-view/log/hassio-addon-log-tab.ts b/hassio/src/addon-view/log/hassio-addon-log-tab.ts index 9f52d3e83296..a40454fe8367 100644 --- a/hassio/src/addon-view/log/hassio-addon-log-tab.ts +++ b/hassio/src/addon-view/log/hassio-addon-log-tab.ts @@ -38,12 +38,13 @@ class HassioAddonLogDashboard extends LitElement { @value-changed=${this._filterChanged} .hass=${this.hass} .filter=${this._filter} - .label=${this.hass.localize("ui.panel.config.logs.search")} + .label=${this.supervisor.localize("ui.panel.config.logs.search")} >
; + @property() public filter = ""; @property() public header?: string; @@ -131,6 +134,7 @@ class ErrorLogCard extends LitElement { @state() private _logsFileLink; protected render(): TemplateResult { + const localize = this.localizeFunc || this.hass.localize; return html`
${this._error @@ -139,8 +143,7 @@ class ErrorLogCard extends LitElement {

- ${this.header || - this.hass.localize("ui.panel.config.logs.show_full_logs")} + ${this.header || localize("ui.panel.config.logs.show_full_logs")}

${this._streamSupported && @@ -148,17 +151,16 @@ class ErrorLogCard extends LitElement { this._showBootsSelect ? html` @@ -180,14 +182,10 @@ class ErrorLogCard extends LitElement { .selected=${boot === this._boot} > ${boot === 0 - ? this.hass.localize( - "ui.panel.config.logs.current" - ) + ? localize("ui.panel.config.logs.current") : boot === -1 - ? this.hass.localize( - "ui.panel.config.logs.previous" - ) - : this.hass.localize( + ? localize("ui.panel.config.logs.previous") + : localize( "ui.panel.config.logs.startups_ago", { boot: boot * -1 } )} @@ -207,9 +205,7 @@ class ErrorLogCard extends LitElement { ` : this._logsFileLink @@ -221,7 +217,7 @@ class ErrorLogCard extends LitElement { > @@ -231,7 +227,7 @@ class ErrorLogCard extends LitElement { @@ -239,7 +235,7 @@ class ErrorLogCard extends LitElement { ? html`` : nothing} ${this._streamSupported && Array.isArray(this._boots) @@ -252,7 +248,7 @@ class ErrorLogCard extends LitElement { slot="graphic" .path=${mdiFormatListNumbered} > - ${this.hass.localize( + ${localize( `ui.panel.config.logs.${this._showBootsSelect ? "hide" : "show"}_haos_boots` )} @@ -271,22 +267,17 @@ class ErrorLogCard extends LitElement {
` : nothing} ${this._loadingState === "loading" - ? html`
- ${this.hass.localize("ui.panel.config.logs.loading_log")} -
` + ? html`
${localize("ui.panel.config.logs.loading_log")}
` : this._loadingState === "empty" - ? html`
- ${this.hass.localize("ui.panel.config.logs.no_errors")} -
` + ? html`
${localize("ui.panel.config.logs.no_errors")}
` : nothing} ${this._loadingState === "loaded" && this.filter && this._noSearchResults ? html`
- ${this.hass.localize( - "ui.panel.config.logs.no_issues_search", - { term: this.filter } - )} + ${localize("ui.panel.config.logs.no_issues_search", { + term: this.filter, + })}
` : nothing} - ${this.hass.localize("ui.panel.config.logs.scroll_down_button")} + ${localize("ui.panel.config.logs.scroll_down_button")} - ${this.hass.localize( - "ui.panel.config.logs.download_logs" - )} + ${localize("ui.panel.config.logs.download_logs")} ` : nothing} - ${this.hass.localize("ui.panel.config.logs.load_logs")} + ${localize("ui.panel.config.logs.load_logs")} ` : nothing} @@ -572,10 +561,13 @@ class ErrorLogCard extends LitElement { if (err.name === "AbortError") { return; } - this._error = this.hass.localize("ui.panel.config.logs.failed_get_logs", { - provider: this.provider, - error: extractApiErrorMessage(err), - }); + this._error = (this.localizeFunc || this.hass.localize)( + "ui.panel.config.logs.failed_get_logs", + { + provider: this.provider, + error: extractApiErrorMessage(err), + } + ); } } diff --git a/src/translations/en.json b/src/translations/en.json index 5165f03d2853..2762e217884c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -7855,6 +7855,62 @@ "restore": "[%key:ui::components::data-table::settings::restore%]" } } + }, + "panel": { + "config": { + "logs": { + "caption": "[%key:ui::panel::config::logs::caption%]", + "description": "[%key:ui::panel::config::logs::description%]", + "details": "[%key:ui::panel::config::logs::details%]", + "search": "[%key:ui::panel::config::logs::search%]", + "failed_get_logs": "[%key:ui::panel::config::logs::failed_get_logs%]", + "no_issues_search": "[%key:ui::panel::config::logs::no_issues_search%]", + "load_logs": "[%key:ui::panel::config::logs::load_logs%]", + "nr_of_lines": "[%key:ui::panel::config::logs::nr_of_lines%]", + "loading_log": "[%key:ui::panel::config::logs::loading_log%]", + "no_errors": "[%key:ui::panel::config::logs::no_errors%]", + "no_issues": "[%key:ui::panel::config::logs::no_issues%]", + "clear": "[%key:ui::panel::config::logs::clear%]", + "refresh": "[%key:ui::panel::config::logs::refresh%]", + "copy": "[%key:ui::panel::config::logs::copy%]", + "log_provider": "[%key:ui::panel::config::logs::log_provider%]", + "multiple_messages": "[%key:ui::panel::config::logs::multiple_messages%]", + "level": { + "critical": "[%key:ui::panel::config::logs::level::critical%]", + "error": "[%key:ui::panel::config::logs::level::error%]", + "warning": "[%key:ui::panel::config::logs::level::warning%]", + "info": "[%key:ui::panel::config::logs::level::info%]", + "debug": "[%key:ui::panel::config::logs::level::debug%]" + }, + "custom_integration": "[%key:ui::panel::config::logs::custom_integration%]", + "error_from_custom_integration": "[%key:ui::panel::config::logs::error_from_custom_integration%]", + "show_full_logs": "[%key:ui::panel::config::logs::show_full_logs%]", + "select_number_of_lines": "[%key:ui::panel::config::logs::select_number_of_lines%]", + "lines": "[%key:ui::panel::config::logs::lines%]", + "download_logs": "[%key:ui::panel::config::logs::download_logs%]", + "scroll_down_button": "[%key:ui::panel::config::logs::scroll_down_button%]", + "provider_not_found": "[%key:ui::panel::config::logs::provider_not_found%]", + "provider_not_available": "[%key:ui::panel::config::logs::provider_not_available%]", + "haos_boots_title": "[%key:ui::panel::config::logs::haos_boots_title%]", + "show_haos_boots": "[%key:ui::panel::config::logs::show_haos_boots%]", + "hide_haos_boots": "[%key:ui::panel::config::logs::hide_haos_boots%]", + "full_width": "[%key:ui::panel::config::logs::full_width%]", + "wrap_lines": "[%key:ui::panel::config::logs::wrap_lines%]", + "current": "[%key:ui::panel::config::logs::current%]", + "previous": "[%key:ui::panel::config::logs::previous%]", + "startups_ago": "[%key:ui::panel::config::logs::startups_ago%]", + "detail": { + "logger": "[%key:ui::panel::config::logs::detail::logger%]", + "source": "[%key:ui::panel::config::logs::detail::source%]", + "integration": "[%key:ui::panel::config::integrations::integration%]", + "documentation": "[%key:ui::panel::config::logs::detail::documentation%]", + "issues": "[%key:ui::panel::config::logs::detail::issues%]", + "first_occurred": "[%key:ui::panel::config::logs::detail::first_occurred%]", + "occurrences": "[%key:ui::panel::config::logs::detail::occurrences%]", + "last_logged": "[%key:ui::panel::config::logs::detail::last_logged%]" + } + } + } } } }