Translated developer tools logs page (#4046)

* Translated developer tools logs page

* Changed translation key from load_log to load_full_log
This commit is contained in:
springstan 2019-10-18 17:43:04 +02:00 committed by Bram Kragten
parent d012512a79
commit 880b382a16
4 changed files with 49 additions and 15 deletions

View File

@ -13,8 +13,10 @@ import "../../../components/dialog/ha-paper-dialog";
import { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail"; import { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail";
import { PolymerChangedEvent } from "../../../polymer-types"; import { PolymerChangedEvent } from "../../../polymer-types";
import { haStyleDialog } from "../../../resources/styles"; import { haStyleDialog } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
class DialogSystemLogDetail extends LitElement { class DialogSystemLogDetail extends LitElement {
public hass!: HomeAssistant;
private _params?: SystemLogDetailDialogParams; private _params?: SystemLogDetailDialogParams;
static get properties(): PropertyDeclarations { static get properties(): PropertyDeclarations {
@ -40,7 +42,13 @@ class DialogSystemLogDetail extends LitElement {
opened opened
@opened-changed="${this._openedChanged}" @opened-changed="${this._openedChanged}"
> >
<h2>Log Details (${item.level})</h2> <h2>
${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.details",
"level",
item.level
)}
</h2>
<paper-dialog-scrollable> <paper-dialog-scrollable>
<p>${new Date(item.timestamp * 1000)}</p> <p>${new Date(item.timestamp * 1000)}</p>
${item.message ${item.message

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../../../types";
import { fetchErrorLog } from "../../../data/error_log"; import { fetchErrorLog } from "../../../data/error_log";
class ErrorLogCard extends LitElement { class ErrorLogCard extends LitElement {
public hass?: HomeAssistant; public hass!: HomeAssistant;
private _errorLog?: string; private _errorLog?: string;
static get properties(): PropertyDeclarations { static get properties(): PropertyDeclarations {
@ -35,7 +35,9 @@ class ErrorLogCard extends LitElement {
` `
: html` : html`
<mwc-button raised @click=${this._refreshErrorLog}> <mwc-button raised @click=${this._refreshErrorLog}>
Load Full Home Assistant Log ${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.load_full_log"
)}
</mwc-button> </mwc-button>
`} `}
</p> </p>
@ -64,9 +66,12 @@ class ErrorLogCard extends LitElement {
} }
private async _refreshErrorLog(): Promise<void> { private async _refreshErrorLog(): Promise<void> {
this._errorLog = "Loading error log…"; this._errorLog = this.hass.localize(
"ui.panel.developer-tools.tabs.logs.loading_log"
);
const log = await fetchErrorLog(this.hass!); const log = await fetchErrorLog(this.hass!);
this._errorLog = log || "No errors have been reported."; this._errorLog =
log || this.hass.localize("ui.panel.developer-tools.tabs.logs.no_errors");
} }
} }

View File

@ -32,7 +32,7 @@ const formatLogTime = (date, language: string) => {
@customElement("system-log-card") @customElement("system-log-card")
export class SystemLogCard extends LitElement { export class SystemLogCard extends LitElement {
public hass?: HomeAssistant; public hass!: HomeAssistant;
public loaded = false; public loaded = false;
private _items?: LoggedError[]; private _items?: LoggedError[];
@ -61,7 +61,11 @@ export class SystemLogCard extends LitElement {
: html` : html`
${this._items.length === 0 ${this._items.length === 0
? html` ? html`
<div class="card-content">There are no new issues!</div> <div class="card-content">
${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.no_issues"
)}
</div>
` `
: this._items.map( : this._items.map(
(item) => html` (item) => html`
@ -78,12 +82,17 @@ export class SystemLogCard extends LitElement {
${item.source} (${item.level}) ${item.source} (${item.level})
${item.count > 1 ${item.count > 1
? html` ? html`
- message first occured at -
${formatLogTime( ${this.hass.localize(
item.first_occured, "ui.panel.developer-tools.tabs.logs.multiple_messages",
this.hass!.language "time",
formatLogTime(
item.first_occured,
this.hass!.language
),
"counter",
item.count
)} )}
and shows up ${item.count} times
` `
: html``} : html``}
</div> </div>
@ -97,10 +106,14 @@ export class SystemLogCard extends LitElement {
.hass=${this.hass} .hass=${this.hass}
domain="system_log" domain="system_log"
service="clear" service="clear"
>Clear</ha-call-service-button >${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.clear"
)}</ha-call-service-button
> >
<ha-progress-button @click=${this.fetchData} <ha-progress-button @click=${this.fetchData}
>Refresh</ha-progress-button >${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.refresh"
)}</ha-progress-button
> >
</div> </div>
`} `}

View File

@ -1789,7 +1789,15 @@
"title": "Info" "title": "Info"
}, },
"logs": { "logs": {
"title": "Logs" "title": "Logs",
"details": "Log Details ({level})",
"load_full_log": "Load Full Home Assistant Log",
"loading_log": "Loading error log…",
"no_errors": "No errors have been reported.",
"no_issues": "There are no new issues!",
"clear": "Clear",
"refresh": "Refresh",
"multiple_messages": "message first occurred at {time} and shows up {counter} times"
}, },
"events": { "events": {
"title": "Events", "title": "Events",