Вместо того, чтобы настраивать ie согласие только один раз при первой загрузке приложения (по крайней мере, то, что кажется, происходит в вашем коде), вы можете подписаться при изменении языка и настраивать его каждый раз, когда это происходит:
export class MyComponent implements OnInit {
ngOnInit() {
this.translateService.onLangChange.subscribe((event: LangChangeEvent) => {
this.configureCookieConsent();
});
this.configureCookieConsent();
}
configureCookieConsent() {
this.translateService
.get(['FOOTER.COOKIES'])
.subscribe(data => {
console.log(data)
this.ccService.getConfig().content = this.ccService.getConfig().content || {} ;
// Override default messages with the translated ones
this.ccService.getConfig().content.message = data['FOOTER.COOKIES'];
this.ccService.destroy();//remove previous cookie bar (with default messages)
this.ccService.init(this.ccService.getConfig()); // update config with translated messages
});
}
}
}
Я использовал компонент в качестве примера, но, конечно, он должен go везде, где вы сейчас настраиваете своего повара ie согласие