Open rubenCodeforges opened 7 years ago
At first sight i guess its doable in here https://github.com/akserg/ng2-toasty/blob/master/src/toasty.service.ts in the add
method, if @akserg you are ok with that , please assign the issue to me ill add the changes.
Btw ive currently a wrapper service:
export class ToastService {
constructor(private toastyService: ToastyService,
private translateServie: TranslateService){
}
default(options: ToastOptions | string | number): void {
if(typeof options == "string") {
this.translateServie.get(options).subscribe((message)=>{
this.toastyService.default(message);
})
}
};
//....
}
Btw if the string is a simple message ( not translation ) the translate service will just return it in the subscribe, so you can do :
this.toastService.default("Im just a string");
this.toastService.success("TOAST.UPDATE.SUCCESS");
Integrate support for translation keys for ngx-translate The ngx-translate is a module that supports translation files, a good idea would be to add its service to translate incoming string so that when you add a translation key to the toast message it will translate it.
example :