Translated developer tools template page (#4050)

This commit is contained in:
springstan 2019-10-18 23:05:07 +02:00 committed by Bram Kragten
parent cc12dbb6ee
commit 442171169b
2 changed files with 15 additions and 8 deletions

View File

@ -3,11 +3,12 @@ import { timeOut } from "@polymer/polymer/lib/utils/async";
import { Debouncer } from "@polymer/polymer/lib/utils/debounce"; import { Debouncer } from "@polymer/polymer/lib/utils/debounce";
import { html } from "@polymer/polymer/lib/utils/html-tag"; import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element"; import { PolymerElement } from "@polymer/polymer/polymer-element";
import LocalizeMixin from "../../../mixins/localize-mixin";
import "../../../components/ha-code-editor"; import "../../../components/ha-code-editor";
import "../../../resources/ha-style"; import "../../../resources/ha-style";
class HaPanelDevTemplate extends PolymerElement { class HaPanelDevTemplate extends LocalizeMixin(PolymerElement) {
static get template() { static get template() {
return html` return html`
<style include="ha-style iron-flex iron-positioning"></style> <style include="ha-style iron-flex iron-positioning"></style>
@ -60,26 +61,25 @@ class HaPanelDevTemplate extends PolymerElement {
<div class$="[[computeFormClasses(narrow)]]"> <div class$="[[computeFormClasses(narrow)]]">
<div class="edit-pane"> <div class="edit-pane">
<p> <p>
Templates are rendered using the Jinja2 template engine with some [[localize('ui.panel.developer-tools.tabs.templates.description')]]
Home Assistant specific extensions.
</p> </p>
<ul> <ul>
<li> <li>
<a <a
href="http://jinja.pocoo.org/docs/dev/templates/" href="http://jinja.pocoo.org/docs/dev/templates/"
target="_blank" target="_blank"
>Jinja2 template documentation</a >[[localize('ui.panel.developer-tools.tabs.templates.jinja_documentation')]]</a
> >
</li> </li>
<li> <li>
<a <a
href="https://home-assistant.io/docs/configuration/templating/" href="https://home-assistant.io/docs/configuration/templating/"
target="_blank" target="_blank"
>Home Assistant template extensions</a >[[localize('ui.panel.developer-tools.tabs.templates.template_extensions')]]</a
> >
</li> </li>
</ul> </ul>
<p>Template editor</p> <p>[[localize('ui.panel.developer-tools.tabs.templates.editor')]]</p>
<ha-code-editor <ha-code-editor
mode="jinja2" mode="jinja2"
value="[[template]]" value="[[template]]"
@ -188,7 +188,9 @@ For loop example:
function(error) { function(error) {
this.processed = this.processed =
(error && error.body && error.body.message) || (error && error.body && error.body.message) ||
"Unknown error rendering template"; this.hass.localize(
"ui.panel.developer-tools.tabs.templates.unknown_error_template"
);
this.error = true; this.error = true;
this.rendering = false; this.rendering = false;
}.bind(this) }.bind(this)

View File

@ -1869,7 +1869,12 @@
"alert_entity_field": "Entity is a mandatory field" "alert_entity_field": "Entity is a mandatory field"
}, },
"templates": { "templates": {
"title": "Template" "title": "Template",
"description": "Templates are rendered using the Jinja2 template engine with some Home Assistant specific extensions.",
"editor": "Template editor",
"jinja_documentation": "Jinja2 template documentation",
"template_extensions": "Home Assistant template extensions",
"unknown_error_template": "Unknown error rendering template"
} }
} }
}, },