Redirecting site home page according to BrowserLocale value

Hello, I want to redirect to the home page on a multilingual site based on the browserLocale value of the site visitor. My site is in three languages, but visitors may have different languages. I want to redirect the first language visitors see according to their local language (browserLocale). I am a beginner at coding. I am getting bad loop in code. Can you help me fix it? Thank you for being here.

My home page code is below…


import wixWindow from ‘wix-window’ ;
import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {

let url = wixLocation . url ;
let browserLocale = wixWindow . browserLocale ;
if (( url === ‘https://www.muruno.com/’ ) && ( browserLocale !== ‘en’ )) {
wixLocation . to ( ‘https://en.muruno.com/’ );
}

**else if**  (( url  ===  'https://www.muruno.com/' ) && ( browserLocale  !==  'de' ))   { 
wixLocation . to ( 'https://de.muruno.com/' ); 

}
else if (( url === ‘https://www.muruno.com/’ ) && ( browserLocale !== ‘fr’ )) {
wixLocation . to ( ‘https://de.muruno.com/’ );
}

**else if**  (( url  ===  'https://www.muruno.com/' ) && ( browserLocale  !==  'da' ))   { 
wixLocation . to ( 'https://de.muruno.com/' ); 

}

**else if**  (( url  ===  'https://www.muruno.com/' ) && ( browserLocale  !==  'tr' )) { 
wixLocation . to ( 'https://www.muruno.com/' ); 

}

else if (( url === ‘https://www.muruno.com/’ ) && ( browserLocale !== ‘az’ )) {
wixLocation . to ( ‘https://www.muruno.com/’ );
}

});