Question:
default/LTR states on multi-tate box doesnt match to the correct language page
Product:
Wix Editor
What are you trying to achieve:
Match correctly between Multi-state box’s states to the current language pages.
I’m trying to copy and paste code from Wix Multilanguial Guide to the two different site language pages code on dev mode in order to match between the correct states and their match language pages.
What have you already tried:
I have already tried to add the code to the page code on dev mode
Additional information:
that is the code i tried to add to the page code on dev mode:
import wixWindow from ‘wix-window’;
const RTLLangs = [‘he’,‘ar’,‘fa’];
$w.onReady(function () {
let lang = wixWindow.multilingual.currentLanguage;
//based on RTL
/////////////////////////////////////
if(RTLLangs.includes(lang)){
$w(‘#statebox8’).changeState(‘RTL’);
}
//based on exact match or default:
/////////////////////////////////////
let states = $w(‘#statebox8’).states;
let foundStates = states.filter((state)=>{state.id === lang});
if(foundStates.length>0){
$w(‘#statebox8’).changeState(foundStates[0]);
}
else{
$w(‘#statebox8’).changeState(‘default’);
}
});