Reputation: 2891
I have this translation defined:
"...has created {{param1}} ({{param2}}) on {{ param3 | date:'mediumDate' }}, {{ param3| date:'shortTime' }}"
param1 and param2 get replaced but param3 is not ({{ param3 | date:'mediumDate' }}, {{ param3| date:'shortTime' }} is printed)...how can I use the datepipe inside a translation?
Upvotes: 2
Views: 5671
Reputation: 8859
When you define your translation like that, ngx-translate expects {{param3 | date:'mediumDate' }} as is.
Instead just try following
"...has created {{param1}} ({{param2}}) on {{ param3 }}, {{ param4}}"
When you want to get your message, use it as follows
{{'path.to.your.message' | translate: {param3: yourDateVariable| date: 'mediumDate'}}}
Upvotes: 8