• Resolved zetpap

    (@zetpap)


    Hi there!
    I manage two pages:
    1. The xrisizimi.gr site is running through wordpress and I cannot seem to be able to set it to work for the two different languages the site uses. I use the WPML plugin.

    2. The barbastathis.com site runs through a custom css and I am not sure how to use the tags described in your support page.

    Can you help?
    Thank you

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author cookiebot

    (@cookiebot)

    Hi @zetpap,

    In Cookiebot Language chose “Use WordPress Language”. This should pick up the WPML language. Also add your languages in the Manager as described here.

    If you are using a cache plugin, remember to update the cache.

    Does that work?

    Thread Starter zetpap

    (@zetpap)

    Hi again.
    In my custom cms site (barbastathis.com), I have set the default language to Greek. I have no option to clear the cache. No luck there, I always get the message in English.
    In my wordpress site (xrisizimi.gr) the message is shown in Greek but when the language changes it stays Greek.

    Thank you again for your help!

    Plugin Author cookiebot

    (@cookiebot)

    @zetpap

    Let’s solve one problem at a time.

    In you WordPress site, chose “Use WordPress Language” under the Cookiebot Language option. See this screenshot: https://prntscr.com/lk6091

    Also, add both Greek and English in the Manager, described here.

    Does it work?

    Thread Starter zetpap

    (@zetpap)

    Ok, one problem solved!
    Let’s go to the second one.

    Thank you very much btw ??

    Plugin Author cookiebot

    (@cookiebot)

    @zetpap

    The reason barbastathis.com shows English, is because your browser language is set to English. If you browser language was set to Greek, it would shown in Greek. This is the auto-detect feature of Cookiebot.

    You can check your personal browser language with this code:

    <script type="text/javascript">
    var userLang = navigator.language || navigator.userLanguage; 
    alert ("The language is: " + userLang);
    </script>

    If you want to enforce a specific language, you can use the data-culture attribute.

    Can you insert below code on your Greek website:

    <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-culture="EL" data-cbid="e89a4ff3-3f95-43d3-8505-ef94dd059c84" type="text/javascript" async></script>

    and on your English website:

    <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-culture="EN" data-cbid="e89a4ff3-3f95-43d3-8505-ef94dd059c84" type="text/javascript" async></script>

    ?

    Thread Starter zetpap

    (@zetpap)

    Indeed my system language is in English.
    Is there a way to set it as in WordPress, to follow the site’s language.
    My site doesn’t seem to have a second header.php for the english version.

    One last question: Is there a script like [cookie_declaration lang=””] for me to use in my custom cms site so I can have my cookies updated?

    Thank you again for all your help!!

    Plugin Author cookiebot

    (@cookiebot)

    @zetpap

    Do you have a way of getting the current culture of the page? English or Greek.

    If so, you could use something like;

    <?php $curLang = substr(get_locale()), 0, 2); ?>
    <script id="Cookiebot" data-culture="<?php echo $curLang?>" src="https://consent.cookiebot.com/uc.js" data-cbid="e89a4ff3-3f95-43d3-8505-ef94dd059c84" type="text/javascript" async></script>

    where substr(get_locale()), 0, 2); would get either EN or EL.

    Plugin Author cookiebot

    (@cookiebot)

    One last question: Is there a script like [cookie_declaration lang=””] for me to use in my custom cms site so I can have my cookies updated?

    You can use data-culture with cd.js as well;

    <script id="CookieDeclaration" src="https://consent.cookiebot.com/e89a4ff3-3f95-43d3-8505-ef94dd059c84/cd.js" data-culture="EN" type="text/javascript" async></script>

    Again, if you want it dynamically, you should get the current language through code. How to achieve that depends on which programming language you are using. If there is no value for it, you can extract it from the URL.

    This is a javascript example just to demonstrate the approach:

    var currentUserPagePathname = location.pathname.toLowerCase();
    var currentUserPageCulture = "en"; //default to English
    
    if (currentUserPagePathname.indexOf("/fr")==0)
    {
     currentUserPageCulture = "fr";
    }
    else if (currentUserPagePathname.indexOf("/es")==0)
    {
     currentUserPageCulture = "es";
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CMS CONTROL LANGUAGE FOR WORPRESS AND CUSTOM CMS’ is closed to new replies.