I have used ng2-translate module for making the translation in my app. But as translate.get method returns observable I always need to subscribe it. To avoid this I want to make one common function in provider which will listen to message constant and returns translated value.
But it returns ‘undefined’, it doesn’t wait for making a translation, I think I can use async and await function. How can I do it?
Here is my code:
public translateString(messageConst):any{ this.translate.get(messageConst).subscribe(value => { return value; }); }