You have to inject the Translate Service in your component :
constructor(private translate: TranslateService) {}
And declare in your translation file something like this :
{
"TOPIC": "Topic {{value}} subscribed!"
}
Then you can choose one of the following way :
Translate instantly :
showToast(this.translate.instant('TOPIC', {value: topic.name}));
Translate with an observable
this.translate.get('TOPIC', {value: topic.name}).subscribe(res => {
showToast(res);
});
Translate directly in the template
{{ 'TOPIC' | translate: {value: topic.name} }}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…