Jump to content

How to display different videos in each language?

Go to solution Solved by tuanphan,

Recommended Posts

17 hours ago, hello_studiofrey said:

Hi @tuanphan

We're using Video Block.  You can find it on the home page of https://www.save-now.ch/ website.

Thanks!
Natasa

You mean this video?

image.thumb.png.bc30bdf0bf2ad5d616f633dec5369da8.png

When change language, WeGlot adds a name to HTML tag of website

Default: html[lang="de-CH"]

If choose English >> It is html[lang="en"]

So we can use this code + target video block id to hide it

For example, if you want to hide current video on English Page, we will use this CSS code

html[lang="en"] div#block-3cc00b0d72362a527745 {
	display: none !important;
}

or on De CH language, use this

html[lang="de-CH"] div#block-3cc00b0d72362a527745 {
	display: none !important;
}

so my ideal is add 2 videos, then use CSS code to hide corresponding video on each page

Use this tool to find video block id: https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 3 weeks later...

Hello @tuanphan 

Thank you very much for your help! The code worked, however, I am not able to play the German video now, even though I see the preview. Also, if I switch from the English version back to German the video doesn't change without the page reload but that is a minor issue. Do you have any idea what could be the problem with the German video? 

Thank you very much!
Cheers
Natasa

 

Link to comment

Try this new code

html[lang="en"], html[lang="en-US"] {
div#block-yui_3_17_2_1_1704897992777_6100 {
    display: none !important;
}
}
html[lang="de-CH"], html[lang="de"] {
div#block-yui_3_17_2_1_1704897992777_9256 {
    display: none !important
}}

If it doesn't work, can you write some text on video or add a first frame to video with EN/DE text? I can test code easier.

Both look similar so it takes a bit of time to know which video is EN and which video is DE

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Top video will show on English Page?

Second video (bottom arrow) will show on German page?

image.thumb.png.f5bc59ead003d236f7a35404bfe6e853.png

Remove code I sent & Use this new CSS code

html[lang="de-CH"], html[lang="de"] {
div#block-yui_3_17_2_1_1704897992777_9256 {
    display: none;
}}
html[lang*="en"] div#block-yui_3_17_2_1_1704897992777_6100 {
    display: none !important;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution

Ah, I targeted wrong ID. Use this new code

html[lang="de-CH"], html[lang="de"] {
.fe-block-yui_3_17_2_1_1704897992777_9256 {
    display: none;
}}
html[lang*="en"] .fe-block-yui_3_17_2_1_1704897992777_6100 {
    display: none !important;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.