lera.cernolev of Help Center Snippets
10/18/2019 - 2:15 PM

[HC] || How can I translate the cookie bar message?

<!-- Begin "Translate Cookie Bar Message" || Help center -->
<!-- Add to Settings->Javascript->Footer -->
<!-- CS:20200120-01-0 -->
<script>
document.addEventListener("DOMContentLoaded", function () {
    var newPageGenerator = window.__page_generator ? true : false;

    if (newPageGenerator) {
        var cookieText = document.querySelector('.snackbar-content');
        var learnMoreLink = document.querySelector('.snackbar-link');
        var yesButton = document.querySelector('#ip-user-consent-accept');
        var noButton = document.querySelector('#ip-user-consent-decline');

    } else {
        var cookieText = document.querySelector('.t-cookie-bar__content p');
        var learnMoreLink = document.querySelector('.t-cookie-bar-link');
        var yesButton = document.querySelector('#ip-cookie-bar-accept');
        var noButton = document.querySelector('#ip-cookie-bar-decline');
    }

    // Only change the text between quotation marks below
    cookieText.childNodes[0].nodeValue = "Enter your description here/Añada su descripción aquí. ";
    learnMoreLink.textContent = "Learn more/Aprende más";
    yesButton.textContent = "Yes, I accept/Sí, acepto";
    noButton.textContent = "I do not accept/No acepto";
})
</script>
<!-- End "Translate Cookie Bar Message" || Help center -->