I want to detect the switch of the "current language" using ngx-translate library.
Which js event I can use to achieve that?
To better understand what I mean, please check this simple example: https://stackblitz.com/edit/github-yvbmgu
I want to detect the change of the currentLang from the "diff" component, on ngOnInit().
You can subscribe to TranslateService's onLangChange
observable to listen to language change events.
ngOnInit() {
console.log(this.translate.currentLang);
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
console.log(event.lang);
});
}