Added support for variables in nunjucks templates for translate filter

This commit is contained in:
Ashish Tank
2020-12-31 18:58:21 +01:00
parent 3fa98bc1aa
commit 4a341b381e
4 changed files with 12 additions and 4 deletions

View File

@@ -69,7 +69,10 @@
<div class="normal medium">
{% if config.showFeelsLike %}
<span class="dimmed">
{{ "FEELS" | translate }} {{ current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }}
{{ "FEELS" | translate({DEGREE: current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }) }}
{% if not config.feelsLikeWithDegree %}
{{ current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }}
{% endif %}
</span>
{% endif %}
{% if config.showPrecipitationAmount %}

View File

@@ -52,7 +52,8 @@ Module.register("weather", {
onlyTemp: false,
showPrecipitationAmount: false,
colored: false,
showFeelsLike: true
showFeelsLike: true,
feelsLikeWithDegree: false
},
// Module properties.
@@ -88,6 +89,8 @@ Module.register("weather", {
// Let the weather provider know we are starting.
this.weatherProvider.start();
this.config.feelsLikeWithDegree = this.translate("FEELS").indexOf("{DEGREE}") > -1;
// Add custom filters
this.addFilters();