Change landing page according to language

I’d like to change the landing page if the visitors change the language or come from another location. It’s possible, or it’s best create “another” site inside the same website? And how can I change the content according to the location? I mean, if I create another website and international visitors enter to automatically change.

Hi :raised_hand_with_fingers_splayed:

You can start doing it by importing Wix Window API and Wix Location API modules.

import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

Then check the current language and redirect visitors based on the language.

const language = wixWindow.multilingual.currentLanguage;

if (language === 'en') {
    wixLocation.to('/en/home')
} else if (language === 'de') {
    wixLocation.to('/en/home')
}

// If you want to dynamic redirecting use this method
wixLocation.to(`/${language}/home`);

Hope this helps~!
Ahmad