Thank you! This worked great!
If it can help someone else, here is my use case.
I have a gallery connected to a database on a multilingual site.
I duplicated the gallery, connected it to a new dataset, connecting the fields to the second language data. Then I set both galleries to hidden and collapsed by default.
Using the example above I adjusted the code to my needs:
import wixWindow from ‘wix-window’ ;
let myLang = wixWindow.multilingual.currentLanguage ;
$w . onReady ( function () {
//changes the gallery to match language selection
if ( myLang === ‘fr’ ){
$w ( ‘#galleryFr’ ). show ()
$w ( ‘#galleryFr’ ). expand ()
}
else if ( myLang === ‘en’ ){
$w ( ‘#galleryEn’ ). show ()
$w ( ‘#galleryEn’ ). expand ()
}
});