mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #2397 from ashishtank/develop
Added support for variables in nunjucks templates for translate filter
This commit is contained in:
commit
a4ab0cbe09
@ -18,6 +18,7 @@ _This release is scheduled to be released on 2021-01-01._
|
||||
- Added SMHI as a provider to Weather module.
|
||||
- Added Hindi & Gujarati translation.
|
||||
- Added optional support for DEGREE position in Feels like translation
|
||||
- Added support for variables in nunjucks templates for translate filter
|
||||
- Chuvash translation.
|
||||
- Calendar: new options "limitDays" and "coloredEvents".
|
||||
- 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 simple-git version to 2.31 unhandled promise rejection (#2383)
|
||||
- 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
|
||||
|
||||
|
@ -175,8 +175,8 @@ var Module = Class.extend({
|
||||
lstripBlocks: true
|
||||
});
|
||||
|
||||
this._nunjucksEnvironment.addFilter("translate", function (str) {
|
||||
return self.translate(str);
|
||||
this._nunjucksEnvironment.addFilter("translate", function (str, variables) {
|
||||
return self.translate(str, variables);
|
||||
});
|
||||
|
||||
return this._nunjucksEnvironment;
|
||||
|
@ -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 %}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user