-
AuthorPosts
-
January 7, 2022 at 1:49 pm #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?
January 10, 2022 at 6:51 am #1334929Hey 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-1323341The 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,
IsmaelJanuary 10, 2022 at 10:09 am #1334934Hi, 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!
January 12, 2022 at 5:51 am #1335169Hi,
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,
IsmaelJanuary 12, 2022 at 10:06 am #1335203Awesome 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!
January 12, 2022 at 12:36 pm #1335225January 12, 2022 at 12:39 pm #1335227Hi 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?
January 13, 2022 at 3:18 am #1335334Hi,
@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,
IsmaelJanuary 13, 2022 at 12:15 pm #1335384Hi Ismael,
Thanks for your help.
It works for text messages very well, but for buttons and tooltip it doesn’t. Screenshot.
January 13, 2022 at 12:37 pm #1335389Also not working for Tab Label and Tab Content fields
January 14, 2022 at 7:44 am #1335518Hi,
@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,
IsmaelJanuary 14, 2022 at 11:03 am #1335544I applied the shortcode you suggested for all the fields in Cookie handling theme options:
– Message
– Button Label
– Button Tootip
– Tab Label
– Tab Contentetc
The shortcode only worked for “Messages”, for the rest of the fields it doesnt
January 14, 2022 at 1:24 pm #1335582Hi,
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,
IsmaelJanuary 15, 2022 at 10:16 am #1335679Here is the link
- This reply was modified 2 years, 10 months ago by cryptotradingbg-com.
January 17, 2022 at 6:58 am #1335830Hi,
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,
IsmaelJanuary 17, 2022 at 10:00 am #1335834Thanks. 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.January 18, 2022 at 5:36 am #1335964Hi,
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,
IsmaelJanuary 25, 2022 at 11:55 am #1337043Hi 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
January 26, 2022 at 4:41 am #1337200Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.