Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #1334675

    Hello,

    I checked all the related threads but couldn’t make it work so opening a new one.

    I am using default Enfold privacy policy popup. But have multilingual website.

    How do I make the privacy popup change languages according to location / subfolder domain of the visitor?

    #1334929

    Hey cryptotradingbg-com,

    Thank you for the inquiry.

    Which multilang plugin are you using? The solution in the following threads might help.

    // https://kriesi.at/support/topic/copyright-mit-datenschutz-jeweils-extra-fur-deutsche-und-englische-website/#post-1318612
    // https://kriesi.at/support/topic/cookie-hinweis-mehrsprachige-website/#post-1323341

    The first solution is for the Polylang plugin and requires a custom shortcode that will allow you to create different content for each language.

    function polylang_shortcode($atts, $content = null){
    	if (empty($content))
    	return '';
    	extract( shortcode_atts( array('lang' => ''), $atts ) );
    	if (empty($lang))
    	return "<h3>You must specify 'lang' using shortcode: polylang</h3>";
    	return ($lang == pll_current_language()) ? $content : '';
    }
    add_shortcode('polylang', 'polylang_shortcode');
    

    This is the example of the shortcode.

    [polylang lang="en"] here is your english phrase [/polylang][polylang lang="de"] und hier kommt die deutsche Entsprechung hinein [/polylang]
    

    Best regards,
    Ismael

    #1334934

    Hi, I use Cookie Handling Message, how can translate (or set diferent Button Link) when I chose (Button Action = Link to another page)?

    I want to set link to cookie policy details in each language that I have in my site, polylang function doesn’t work in this case, thanks!

    #1335169

    Hi,

    You can create a separate button for each language and use css to control their visibility based on the active language. If there are two languages for example (en_US and de_DE), you have to create two buttons, the first button for the EN site and next one for the other. The order of the button here is important. After creating the buttons, use the following css code to control buttons’ visibility based on the active language.

    html[lang="en-US"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(1) {
      display: inline-block;
    }
    
    html[lang="de-DE"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(2) {
      display: inline-block;
    }
    

    You may noticed that we used nth-child selectors in the css code above to select the appropriate button for the active language. Lastly, we have to set the initial display property of the buttons with this css code in order to hide the inactive button.

    #top .avia-cookie-consent .avia-cookie-link-btn {
      display: none;
    }

    Best regards,
    Ismael

    #1335203

    Awesome Ismael, it works! I hadn’t thought of being able to use “: lang pseudo-class” to perform this task.

    In my case I used “nth-child(3) and nth-child(4)”

    Thanks!

    #1335225

    Hi Gabri,

    Great, I’m glad that Ismael could help you out.

    Best regards,
    Rikard

    #1335227

    Hi Ismael,

    Thanks for your reply.
    It is with polylang indeed. I tried the first solution, but not sure I insert in the right places.

    Custom short code should (the first bigger one) should go to quick CSS? And then the Example should go into the content field of enfold Privacy policy?

    #1335334

    Hi,

    @Gabri: Glad to know it worked out. Please feel free to open a different thread if you need anything else.


    @cryptotradingbg-com
    : The first snippet, which registers the custom shortcode, should go in the functions.php file and yes, the second one or the actual shortcode will go to the privacy policy fields or messages.

    Best regards,
    Ismael

    #1335384

    Hi Ismael,

    Thanks for your help.

    It works for text messages very well, but for buttons and tooltip it doesn’t. Screenshot.

    #1335389

    Also not working for Tab Label and Tab Content fields

    #1335518

    Hi,


    @cryptotradingbg-com
    : What do you mean by “text messages”? For the buttons, you have to use the css solution that we discussed above.

    Best regards,
    Ismael

    #1335544

    I applied the shortcode you suggested for all the fields in Cookie handling theme options:

    – Message
    – Button Label
    – Button Tootip
    – Tab Label
    – Tab Content

    etc

    The shortcode only worked for “Messages”, for the rest of the fields it doesnt

    #1335582

    Hi,

    Thanks for the update.

    The shortcode is supposed to work in the Tab Content field. What are the active languages in the site? Please provide the site URL in the private field so that we can check it.

    Best regards,
    Ismael

    #1335679

    Here is the link

    #1335830

    Hi,

    For the tab title, we can add different text for each language and separate them using a span tag. We can then do what we did with the buttons and control their visiblity with css. Add this code in one of the tab title fields for example.

    <span class="av-priv-bg">Как използваме бисквитки</span><span class="av-priv-tr">Как използваме бисквитки TR</span>
    

    We added two span tags with different class name, one for the BR language and another for TR. We already added this css code in the Quick CSS field to control the visibility of the text or span element.

    .avia-popup #av-consent-extra-info .tab span {
        display: none;
    }
    
    html[lang="bg-BG"] .avia-popup #av-consent-extra-info .tab .av-priv-bg {
        display: inline-block;
    }
    
    html[lang="tr-TR"] .avia-popup #av-consent-extra-info .tab .av-priv-tr {
        display: inline-block;
    }
    
    

    Please make sure to purge the cache before checking the page.

    Best regards,
    Ismael

    #1335834

    Thanks. I am sorry but this doesn’t work either.
    Buttons show both languages now (pls see scr shot). And where there is [av_privacy_google_tracking] check, it gets quite messy showing also both languages in the field.

    #1335964

    Hi,

    It is actually working the last time we checked. Did you edit the first Tab Title field? That is where we add the span tags. Make sure to wrap the text inside the span elements.

    This is for the BG language.

    <span class="av-priv-bg">Как използваме бисквитки</span>
    

    And this is for TR.

    <span class="av-priv-tr">TR Как използваме бисквитки TR</span>
    

    You can also use this for the privacy shortcodes or toggles. Just make sure to add this css code.

    #top .av-priv-bg, #top .av-priv-tr {
        display: none;
    }
    
    html[lang="bg-BG"] #top .av-priv-bg {
        display: inline-block;
    }
    
    html[lang="tr-TR"] #top .av-priv-tr {
        display: inline-block;
    }
    

    Anything that you add inside those span elements should display if the corresponding language is active.

    Best regards,
    Ismael

    #1337043

    Hi Ismael,

    I did as you recommended. Some of them work some of them don’t.

    On the screenshot you can find buttons showing 2 different language.

    Please find screenshot and link

    #1337200

    Hi,

    For the privacy button, we already mentioned that the order of the buttons is important in this case because we are using the nth-child selectors to target them. Please make sure that the first two buttons are for the BG language and the next two for TR, then use this css code.

    html[lang="bg-BG"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(1), html[lang="bg-BG"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(2) {
      display: inline-block;
    }
    
    html[lang="tr-TR"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(3), html[lang="tr-TR"] #top .avia-cookie-consent .avia-cookie-link-btn:nth-child(4){
      display: inline-block;
    }

    Make sure that this css code is added as well to toggle the initial display of the buttons.

    #top .avia-cookie-consent .avia-cookie-link-btn {
      display: none;
    }
    

    Thank you for your patience.

    Best regards,
    Ismael

Viewing 19 posts - 1 through 19 (of 19 total)
  • You must be logged in to reply to this topic.