mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Added support for variables in nunjucks templates for translate filter
This commit is contained in:
parent
3fa98bc1aa
commit
4a341b381e
@ -18,6 +18,7 @@ _This release is scheduled to be released on 2021-01-01._
|
|||||||
- Added SMHI as a provider to Weather module.
|
- Added SMHI as a provider to Weather module.
|
||||||
- Added Hindi & Gujarati translation.
|
- Added Hindi & Gujarati translation.
|
||||||
- Added optional support for DEGREE position in Feels like translation
|
- Added optional support for DEGREE position in Feels like translation
|
||||||
|
- Added support for variables in nunjucks templates for translate filter
|
||||||
- Chuvash translation.
|
- Chuvash translation.
|
||||||
- Calendar: new options "limitDays" and "coloredEvents".
|
- Calendar: new options "limitDays" and "coloredEvents".
|
||||||
- Added new option "limitDays" - limit the number of discreet days displayed.
|
- Added new option "limitDays" - limit the number of discreet days displayed.
|
||||||
@ -63,6 +64,7 @@ _This release is scheduled to be released on 2021-01-01._
|
|||||||
- update node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch)
|
- update node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch)
|
||||||
- update simple-git version to 2.31 unhandled promise rejection (#2383)
|
- update simple-git version to 2.31 unhandled promise rejection (#2383)
|
||||||
- Translator variables can have falsy values (e.g. empty string)
|
- Translator variables can have falsy values (e.g. empty string)
|
||||||
|
- Fix issue with weather module with DEGREE label in FEELS like
|
||||||
|
|
||||||
## [2.13.0] - 2020-10-01
|
## [2.13.0] - 2020-10-01
|
||||||
|
|
||||||
|
@ -175,8 +175,8 @@ var Module = Class.extend({
|
|||||||
lstripBlocks: true
|
lstripBlocks: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this._nunjucksEnvironment.addFilter("translate", function (str) {
|
this._nunjucksEnvironment.addFilter("translate", function (str, variables) {
|
||||||
return self.translate(str);
|
return self.translate(str, variables);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this._nunjucksEnvironment;
|
return this._nunjucksEnvironment;
|
||||||
|
@ -69,7 +69,10 @@
|
|||||||
<div class="normal medium">
|
<div class="normal medium">
|
||||||
{% if config.showFeelsLike %}
|
{% if config.showFeelsLike %}
|
||||||
<span class="dimmed">
|
<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>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.showPrecipitationAmount %}
|
{% if config.showPrecipitationAmount %}
|
||||||
|
@ -52,7 +52,8 @@ Module.register("weather", {
|
|||||||
onlyTemp: false,
|
onlyTemp: false,
|
||||||
showPrecipitationAmount: false,
|
showPrecipitationAmount: false,
|
||||||
colored: false,
|
colored: false,
|
||||||
showFeelsLike: true
|
showFeelsLike: true,
|
||||||
|
feelsLikeWithDegree: false
|
||||||
},
|
},
|
||||||
|
|
||||||
// Module properties.
|
// Module properties.
|
||||||
@ -88,6 +89,8 @@ Module.register("weather", {
|
|||||||
// Let the weather provider know we are starting.
|
// Let the weather provider know we are starting.
|
||||||
this.weatherProvider.start();
|
this.weatherProvider.start();
|
||||||
|
|
||||||
|
this.config.feelsLikeWithDegree = this.translate("FEELS").indexOf("{DEGREE}") > -1;
|
||||||
|
|
||||||
// Add custom filters
|
// Add custom filters
|
||||||
this.addFilters();
|
this.addFilters();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user