Hello,
My site is multilingual.
I created a database but the correct data is not selected when choosing a different language.
I know this feature is not available yet (Last posts about it are from Jan, 2019…) but I think there might be a solution with coding. I tried using this code :
import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;
$w.onReady( function () {
//TODO: write your page related code here…
$w( “#dynamicDataset” ).onReady( () => {
console.log( “the dataset is ready” );
update_items();
});
$w( “#dynamicDataset” ).onCurrentIndexChanged( (index) => {
console.log( “the item changed” );
update_items();
});
});
function update_items () {
const current_item = $w( “#dynamicDataset” ).getCurrentItemIndex();
let language = wixWindow.multilingual.currentLanguage;
let description_text;
console.log(current_item);
wixData.query( “PRODUITS” ).find().
then( (results) => {
if (language === “es” ){
description_text = results.items[current_item].description_es;
} else if (language === “fr” ) {
description_text = results.items[current_item].description_fr;
} else {
description_text = results.items[current_item].description_fr;
}
$w( “#text1” ).text = description_text;
});
}
But the description just disappears in both languages instead of selecting the correct description…
I am not familiar with this so any help would be great !
Thanks a lot !