Skip to content

Language switch issue #150

Answered by orestbida
AhaDigital asked this question in Q&A
Dec 14, 2021 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @AhaDigital ,

Do we have a bug here or does this script only work with hard refresh to another language or am I doing it all wrong?
I also wonder if there is a way to re-initialize window.initCookieConsent(); if there is no way to update language dynamically?

Yes, the plugin is initialized only once. Since it doesn't have any active listeners, and doesn't use any react state (the plugin is not a react component) it can't update automatically the content of the modals.

Currently the only way to change the language — without reloading the page — would be to remove the root HTMLDivElement from the DOM: <div id="cc--main">...</div> and then call again the .run({...}) method with the new la…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@AhaDigital
Comment options

Answer selected by AhaDigital
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants