Added support for variables in nunjucks templates for translate filter#2397
Added support for variables in nunjucks templates for translate filter#2397MichMich merged 2 commits intoMagicMirrorOrg:developfrom
Conversation
| <span class="dimmed"> | ||
| {{ "FEELS" | translate }} {{ current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }} | ||
| {{ "FEELS" | translate({DEGREE: current.feelsLike() | roundValue | unit("temperature") | decimalSymbol }) }} | ||
| {% if not config.feelsLikeWithDegree %} |
There was a problem hiding this comment.
I'd rather add the DEGREE placeholder in all other translations too, so we can get rid of these if clauses.
| // Let the weather provider know we are starting. | ||
| this.weatherProvider.start(); | ||
|
|
||
| this.config.feelsLikeWithDegree = this.translate("FEELS").indexOf("{DEGREE}") > -1; |
There was a problem hiding this comment.
with DEGREE in all translations this would not be necessary either
There was a problem hiding this comment.
I would suggest to keep it as it is. As it is optional and very few languages will need DEGREE placeholder. If we add DEGREE placeholder it might break other modules who are using FEELS like resource string in their modules. New languages (Hindi and Gujarati) only have it now and if any third party is using it they need to correct it for this lang. only.
|
@rejas, does this solve the issue for you? Should I merge this or revert the other? |
|
@MichMich that solves the issue. you can merge it. still the question is: do other modules rely on this translation? becuase I really think this should be solved in the translation files and not in the code. or what is your stance on this. |
|
Yeah. I agree we should clean it up. It's a bit too specific. But for now I'll merge it. |
|
U2! 🎉 |
|
Happy new year to everybody! Stay healthy! |
Added support for variables in nunjucks templates for translate filter
Fix issue with weather module with DEGREE label in FEELS like