Hide element according to user's language choise

Hi
Looked all over the posts about multilingual website and couldn’t find how to show/hide elements when changing language.
I want to be able to put different menu on the EN version, and another on the HE version.

Please guide me though it.
Tnx

Hi Lior,
I have the same question. Did you get an answer to yours?

Kind regards
Christian

Hi Lior,
Assuming that you’re asking about language choice of Wix Multilingual, here’s a code snippet which shows how to show/hide a menu element according to the language selected:

import wixWindow from ‘wix-window’;

$w.onReady(function () {
if (wixWindow.multilingual.currentLanguage === ‘he’) {
$w(‘#horizontalMenu2’).hide();
$w(‘#horizontalMenu1’).show();
} else {
$w(‘#horizontalMenu1’).hide();
$w(‘#horizontalMenu2’).show();
}
});

Hope this helps.

Jacob

Hi Jacob,

I was wondering if you could please guide me on how to show a video with English voice-over for the English site, and one with Spanish voice-over for the Spanish one. I can’t find any information online on how to do this, and I don’t know how to code. I would really appreciate the help. Thank you.

Karen.

Hi Karen

If you tweak the Jacobs code above you can achieve it. A simple solution will be add two video elements. Name it englishVideo and spanishVideo and then place both just above each other or in your desire positions. In the properties panel set it to hide on load and use the code below.

import wixWindow from 'wix-window';


$w.onReady(function () {
    if (wixWindow.multilingual.currentLanguage ===  'en') {
        $w('#spanishVideo').hide();
        $w('#englishVideo').show();
    } else {
        $w('#englishVideo').hide();
        $w('#spanishVideo').show();
    }
});

Thank you so much!! It worked!!

Well… I’m afraid it didn’t, I don’t know what I’m doing wrong, but it works only in preview. When I go to the live site on my browser, it only shows the Spanish video; and in mobile, it shows both. I cleared the cache in both my computer and my phone, and used another computer and phone that had never entered the page.

Well, I don’t know what I’m doing wrong, but it’s not working. I replied to you after testing it on preview, however, when I go to the live site, it’s only showing the Spanish video, and in mobile it’s showing both of them. I cleared the cache on my browser ad well on my phone and it didn’t make a difference. I also used another phone and computer that had never accessed the site and I’m still finding the same issues.