Hi,
Using the wixLocation.to function depends if it is an external URL or a page within the site. I recommend checking out the documentation here .
As for using the locale option instead, you can do the following:
import wixWindow from 'wix-window';
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
let locale = wixWindow.locale;
let lang = local.getItem('siteLangPref');
if (!lang) {
//using the locale in case the user hasn't chosen the relevant
// language
if (locale === "fr"){
lang = 'french';
}
else{
lang = 'english';
}
}
traslateAll(lang);
});
I hope it’s clear.
Good luck ![]()
Tal