Add translate tags to "cards" (#818)

* Add translate tags to "cards"

affected cards:
 - camera card
 - persistent notification
 - weather

* Add translate tags to "cards"

code style

* Add translate tags to "cards"

changes from code review
This commit is contained in:
Matthias Dötsch 2018-01-21 07:08:47 +01:00 committed by Paulus Schoutsen
parent 8649c5352b
commit 50ed7678a1
4 changed files with 29 additions and 8 deletions

View File

@ -44,7 +44,7 @@
<div class='caption'>
[[computeStateName(stateObj)]]
<template is='dom-if' if='[[!imageLoaded]]'>
(Image not available)
([[localize('ui.card.camera.not_available')]])
</template>
</div>
</template>
@ -54,7 +54,8 @@
{
const UPDATE_INTERVAL = 10000; // ms
class HaCameraCard extends window.hassMixins.EventsMixin(Polymer.Element) {
class HaCameraCard extends
window.hassMixins.LocalizeMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
static get is() { return 'ha-camera-card'; }
static get properties() {
return {

View File

@ -4,6 +4,8 @@
<link rel='import' href='../components/ha-card.html'>
<link rel='import' href='../components/ha-markdown.html'>
<link rel='import' href='../util/hass-mixins.html'>
<dom-module id='ha-persistent_notification-card'>
<template>
<style>
@ -37,13 +39,13 @@
<ha-card header='[[computeTitle(stateObj)]]'>
<ha-markdown content='[[stateObj.attributes.message]]'></ha-markdown>
<paper-button on-tap='dismissTap'>DISMISS</paper-button>
<paper-button on-tap='dismissTap'>[[localize('ui.card.persistent_notification.dismiss')]]</paper-button>
</ha-card>
</template>
</dom-module>
<script>
class HaPersistentNotificationCard extends Polymer.Element {
class HaPersistentNotificationCard extends window.hassMixins.LocalizeMixin(Polymer.Element) {
static get is() { return 'ha-persistent_notification-card'; }
static get properties() {
return {

View File

@ -2,6 +2,9 @@
<link rel='import' href='../../bower_components/iron-flex-layout/iron-flex-layout-classes.html'>
<link rel='import' href='../../bower_components/google-apis/google-legacy-loader.html'>
<link rel='import' href='../components/ha-card.html'>
<link rel='import' href='../util/hass-mixins.html'>
<dom-module id='ha-weather-card'>
<template>
<style>
@ -48,17 +51,17 @@
<div class='cond condtemp'>[[attr.temperature]]°</div>
<div class='cond conddetails'>
<div class="condsmall" hidden$="[[!attr.wind_speed]]">
Wind:
[[localize('attribute.weather.wind_speed')]]:
<span hidden$="[[!attr.wind_speed]]">
[[attr.wind_speed]]
</span>
<span hidden$="[[!windBearing]]">[[windBearing]]</span>
</div>
<div class="condsmall" hidden$="[[!attr.humidity]]">
Humidity: [[attr.humidity]]%
[[localize('attribute.weather.humidity')]]: [[attr.humidity]]%
</div>
<div class="condsmall" hidden$="[[!attr.visibility]]">
Visibility: [[attr.visibility]]
[[localize('attribute.weather.visibility')]]: [[attr.visibility]]
</div>
</div>
<div class='clear'></div>
@ -93,7 +96,7 @@
'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'
];
class HaWeatherCard extends Polymer.Element {
class HaWeatherCard extends window.hassMixins.LocalizeMixin(Polymer.Element) {
static get is() { return 'ha-weather-card'; }
static get properties() {
return {

View File

@ -1,4 +1,11 @@
{
"attribute": {
"weather": {
"humidity": "Humidity",
"visibility": "Visibility",
"wind_speed": "Wind speed"
}
},
"domain": {
"alarm_control_panel": "Alarm control panel",
"automation": "Automation",
@ -294,6 +301,14 @@
}
},
"ui": {
"card": {
"camera": {
"not_available": "Image not available"
},
"persistent_notification": {
"dismiss": "Dismiss"
}
},
"common": {
"loading": "Loading",
"cancel": "Cancel"