1. Change the default text in the content.
2. Change network speed to 3g from chrome networks tab.
3. Reload the page and the cookie consent default value is shown for few seconds before the translation changes appear
4. How I fixed this is with a simple hack -
* In AppModule config for cookie consent, I used autoOpen: false
* In AppComponent ngOnInit method I used this -
this.translate.get(['cookie.header', 'cookie.message', 'cookie.dismiss', 'cookie.allow', 'cookie.deny', 'cookie.link']).subscribe(data => {
this.ccService.getConfig().content = this.ccService.getConfig().content || {} ;
// Override default messages with the translated ones
this.ccService.getConfig().content.header = data['cookie.header'];
this.ccService.getConfig().content.message = data['cookie.message'];
this.ccService.getConfig().content.dismiss = data['cookie.dismiss'];
this.ccService.getConfig().content.allow = data['cookie.allow'];
this.ccService.getConfig().content.deny = data['cookie.deny'];
this.ccService.getConfig().content.link = data['cookie.link'];
this.ccService.init(this.ccService.getConfig());
if (!this.ccService.hasConsented())
this.ccService.open();
else
this.ccService.destroy();
});
The log given by the failure
Desired functionality
The cookie consent should show the custom content only but not the default values. This leads to bad experience for slow networks.
Thanks for reporting this.
I will update the README.md section about i18n to mention your hack, which is, to me, the best way to address the issue (due to async nature of translation mechanism).
Bug Report or Feature Request (mark with an
x
)OS and Version?
Versions
Repro steps
The log given by the failure
Desired functionality
The cookie consent should show the custom content only but not the default values. This leads to bad experience for slow networks.
Mention any other details that might be useful