mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 10:16:46 +00:00
Fix hassio logs translations (#22693)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
ed3096157c
commit
26e914290d
@ -38,12 +38,13 @@ class HassioAddonLogDashboard extends LitElement {
|
|||||||
@value-changed=${this._filterChanged}
|
@value-changed=${this._filterChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.filter=${this._filter}
|
.filter=${this._filter}
|
||||||
.label=${this.hass.localize("ui.panel.config.logs.search")}
|
.label=${this.supervisor.localize("ui.panel.config.logs.search")}
|
||||||
></search-input>
|
></search-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<error-log-card
|
<error-log-card
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.localizeFunc=${this.supervisor.localize}
|
||||||
.header=${this.addon.name}
|
.header=${this.addon.name}
|
||||||
.provider=${this.addon.slug}
|
.provider=${this.addon.slug}
|
||||||
show
|
show
|
||||||
|
@ -64,6 +64,7 @@ import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
|||||||
import { debounce } from "../../../common/util/debounce";
|
import { debounce } from "../../../common/util/debounce";
|
||||||
import { showDownloadLogsDialog } from "./show-dialog-download-logs";
|
import { showDownloadLogsDialog } from "./show-dialog-download-logs";
|
||||||
import type { HaMenu } from "../../../components/ha-menu";
|
import type { HaMenu } from "../../../components/ha-menu";
|
||||||
|
import type { LocalizeFunc } from "../../../common/translations/localize";
|
||||||
|
|
||||||
const NUMBER_OF_LINES = 100;
|
const NUMBER_OF_LINES = 100;
|
||||||
|
|
||||||
@ -71,6 +72,8 @@ const NUMBER_OF_LINES = 100;
|
|||||||
class ErrorLogCard extends LitElement {
|
class ErrorLogCard extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public localizeFunc?: LocalizeFunc<any>;
|
||||||
|
|
||||||
@property() public filter = "";
|
@property() public filter = "";
|
||||||
|
|
||||||
@property() public header?: string;
|
@property() public header?: string;
|
||||||
@ -131,6 +134,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
@state() private _logsFileLink;
|
@state() private _logsFileLink;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
|
const localize = this.localizeFunc || this.hass.localize;
|
||||||
return html`
|
return html`
|
||||||
<div class="error-log-intro">
|
<div class="error-log-intro">
|
||||||
${this._error
|
${this._error
|
||||||
@ -139,8 +143,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
<ha-card outlined class=${classMap({ hidden: this.show === false })}>
|
<ha-card outlined class=${classMap({ hidden: this.show === false })}>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1 class="card-header">
|
<h1 class="card-header">
|
||||||
${this.header ||
|
${this.header || localize("ui.panel.config.logs.show_full_logs")}
|
||||||
this.hass.localize("ui.panel.config.logs.show_full_logs")}
|
|
||||||
</h1>
|
</h1>
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
${this._streamSupported &&
|
${this._streamSupported &&
|
||||||
@ -148,17 +151,16 @@ class ErrorLogCard extends LitElement {
|
|||||||
this._showBootsSelect
|
this._showBootsSelect
|
||||||
? html`
|
? html`
|
||||||
<ha-assist-chip
|
<ha-assist-chip
|
||||||
.title=${this.hass.localize(
|
.title=${localize(
|
||||||
"ui.panel.config.logs.haos_boots_title"
|
"ui.panel.config.logs.haos_boots_title"
|
||||||
)}
|
)}
|
||||||
.label=${this._boot === 0
|
.label=${this._boot === 0
|
||||||
? this.hass.localize("ui.panel.config.logs.current")
|
? localize("ui.panel.config.logs.current")
|
||||||
: this._boot === -1
|
: this._boot === -1
|
||||||
? this.hass.localize("ui.panel.config.logs.previous")
|
? localize("ui.panel.config.logs.previous")
|
||||||
: this.hass.localize(
|
: localize("ui.panel.config.logs.startups_ago", {
|
||||||
"ui.panel.config.logs.startups_ago",
|
boot: this._boot * -1,
|
||||||
{ boot: this._boot * -1 }
|
})}
|
||||||
)}
|
|
||||||
id="boots-anchor"
|
id="boots-anchor"
|
||||||
@click=${this._toggleBootsMenu}
|
@click=${this._toggleBootsMenu}
|
||||||
>
|
>
|
||||||
@ -180,14 +182,10 @@ class ErrorLogCard extends LitElement {
|
|||||||
.selected=${boot === this._boot}
|
.selected=${boot === this._boot}
|
||||||
>
|
>
|
||||||
${boot === 0
|
${boot === 0
|
||||||
? this.hass.localize(
|
? localize("ui.panel.config.logs.current")
|
||||||
"ui.panel.config.logs.current"
|
|
||||||
)
|
|
||||||
: boot === -1
|
: boot === -1
|
||||||
? this.hass.localize(
|
? localize("ui.panel.config.logs.previous")
|
||||||
"ui.panel.config.logs.previous"
|
: localize(
|
||||||
)
|
|
||||||
: this.hass.localize(
|
|
||||||
"ui.panel.config.logs.startups_ago",
|
"ui.panel.config.logs.startups_ago",
|
||||||
{ boot: boot * -1 }
|
{ boot: boot * -1 }
|
||||||
)}
|
)}
|
||||||
@ -207,9 +205,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
.path=${mdiDownload}
|
.path=${mdiDownload}
|
||||||
@click=${this._downloadLogs}
|
@click=${this._downloadLogs}
|
||||||
.label=${this.hass.localize(
|
.label=${localize("ui.panel.config.logs.download_logs")}
|
||||||
"ui.panel.config.logs.download_logs"
|
|
||||||
)}
|
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
`
|
`
|
||||||
: this._logsFileLink
|
: this._logsFileLink
|
||||||
@ -221,7 +217,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
>
|
>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
.path=${mdiDownload}
|
.path=${mdiDownload}
|
||||||
.label=${this.hass.localize(
|
.label=${localize(
|
||||||
"ui.panel.config.logs.download_logs"
|
"ui.panel.config.logs.download_logs"
|
||||||
)}
|
)}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
@ -231,7 +227,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
.path=${this._wrapLines ? mdiWrapDisabled : mdiWrap}
|
.path=${this._wrapLines ? mdiWrapDisabled : mdiWrap}
|
||||||
@click=${this._toggleLineWrap}
|
@click=${this._toggleLineWrap}
|
||||||
.label=${this.hass.localize(
|
.label=${localize(
|
||||||
`ui.panel.config.logs.${this._wrapLines ? "full_width" : "wrap_lines"}`
|
`ui.panel.config.logs.${this._wrapLines ? "full_width" : "wrap_lines"}`
|
||||||
)}
|
)}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
@ -239,7 +235,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
? html`<ha-icon-button
|
? html`<ha-icon-button
|
||||||
.path=${mdiRefresh}
|
.path=${mdiRefresh}
|
||||||
@click=${this._loadLogs}
|
@click=${this._loadLogs}
|
||||||
.label=${this.hass.localize("ui.common.refresh")}
|
.label=${localize("ui.common.refresh")}
|
||||||
></ha-icon-button>`
|
></ha-icon-button>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._streamSupported && Array.isArray(this._boots)
|
${this._streamSupported && Array.isArray(this._boots)
|
||||||
@ -252,7 +248,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
slot="graphic"
|
slot="graphic"
|
||||||
.path=${mdiFormatListNumbered}
|
.path=${mdiFormatListNumbered}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
${this.hass.localize(
|
${localize(
|
||||||
`ui.panel.config.logs.${this._showBootsSelect ? "hide" : "show"}_haos_boots`
|
`ui.panel.config.logs.${this._showBootsSelect ? "hide" : "show"}_haos_boots`
|
||||||
)}
|
)}
|
||||||
</ha-list-item>
|
</ha-list-item>
|
||||||
@ -271,22 +267,17 @@ class ErrorLogCard extends LitElement {
|
|||||||
</div>`
|
</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._loadingState === "loading"
|
${this._loadingState === "loading"
|
||||||
? html`<div>
|
? html`<div>${localize("ui.panel.config.logs.loading_log")}</div>`
|
||||||
${this.hass.localize("ui.panel.config.logs.loading_log")}
|
|
||||||
</div>`
|
|
||||||
: this._loadingState === "empty"
|
: this._loadingState === "empty"
|
||||||
? html`<div>
|
? html`<div>${localize("ui.panel.config.logs.no_errors")}</div>`
|
||||||
${this.hass.localize("ui.panel.config.logs.no_errors")}
|
|
||||||
</div>`
|
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._loadingState === "loaded" &&
|
${this._loadingState === "loaded" &&
|
||||||
this.filter &&
|
this.filter &&
|
||||||
this._noSearchResults
|
this._noSearchResults
|
||||||
? html`<div>
|
? html`<div>
|
||||||
${this.hass.localize(
|
${localize("ui.panel.config.logs.no_issues_search", {
|
||||||
"ui.panel.config.logs.no_issues_search",
|
term: this.filter,
|
||||||
{ term: this.filter }
|
})}
|
||||||
)}
|
|
||||||
</div>`
|
</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
<ha-ansi-to-html
|
<ha-ansi-to-html
|
||||||
@ -307,7 +298,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
.path=${mdiArrowCollapseDown}
|
.path=${mdiArrowCollapseDown}
|
||||||
slot="icon"
|
slot="icon"
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
${this.hass.localize("ui.panel.config.logs.scroll_down_button")}
|
${localize("ui.panel.config.logs.scroll_down_button")}
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
.path=${mdiArrowCollapseDown}
|
.path=${mdiArrowCollapseDown}
|
||||||
slot="trailingIcon"
|
slot="trailingIcon"
|
||||||
@ -328,14 +319,12 @@ class ErrorLogCard extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<ha-button outlined @click=${this._downloadLogs}>
|
<ha-button outlined @click=${this._downloadLogs}>
|
||||||
<ha-svg-icon .path=${mdiDownload}></ha-svg-icon>
|
<ha-svg-icon .path=${mdiDownload}></ha-svg-icon>
|
||||||
${this.hass.localize(
|
${localize("ui.panel.config.logs.download_logs")}
|
||||||
"ui.panel.config.logs.download_logs"
|
|
||||||
)}
|
|
||||||
</ha-button>
|
</ha-button>
|
||||||
`
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
<mwc-button raised @click=${this._showLogs}>
|
<mwc-button raised @click=${this._showLogs}>
|
||||||
${this.hass.localize("ui.panel.config.logs.load_logs")}
|
${localize("ui.panel.config.logs.load_logs")}
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
`
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
@ -572,10 +561,13 @@ class ErrorLogCard extends LitElement {
|
|||||||
if (err.name === "AbortError") {
|
if (err.name === "AbortError") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._error = this.hass.localize("ui.panel.config.logs.failed_get_logs", {
|
this._error = (this.localizeFunc || this.hass.localize)(
|
||||||
provider: this.provider,
|
"ui.panel.config.logs.failed_get_logs",
|
||||||
error: extractApiErrorMessage(err),
|
{
|
||||||
});
|
provider: this.provider,
|
||||||
|
error: extractApiErrorMessage(err),
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7855,6 +7855,62 @@
|
|||||||
"restore": "[%key:ui::components::data-table::settings::restore%]"
|
"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%]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user