I have a 3 languages webpage and use a embeded application (ecwid) which display automatically in the language set in the browser. I would like Wix and Ecwid display in the same language by default. So I need Wix to use the browser language to translate the pages too instead of using the language stored in the last session…
Also in Wix I use a DB collection named "translation"which works as a template to translate in 3 languages according to the code detailed below.
Is there someone who could help me to change the code in Wix to display the pages in the language set in the browser by default.
Hello,
I’ m contacting you again as I really need to have my visitors redirected according to the language set in their browser and not according to the language stored in the last session.
The solution does exist in the Wix language app as shown below. So I can’t believe that WiX code which is supposed to go further and better, doesn’t help in this case.
Unfortunately, I can’t use this app as I can’t duplicate the page of my Ecwid store app.
So, I would really appreciate if someone could help me to redirect the visitors according to the browser language. I know it is possible with Javascript but I don’t know how to embed if it’s the solution.
Thanks for your help
Another option is copying the code here and use post message to send a message to the site. Than, you can read the message and redirect to the relevant page as explained in the previous thread .
Note that it can take few seconds till the page is loaded, gets the message from the iFrame and redirected to the relevant page.
Hello Tal
Thank you for your answer giving this other solution but I don’t want it takes too long to load a page. So I was thinking of using actually the Wix language app that permits to redirect visitors according to their browser language. So it means I have finally to duplicate the pages . Also in the page of the online store I will not display any menu on the header but a button which permits to go back to the homepage according to the language.
with the Go back home button I can use wixLocation.to (“https://wixsite.com/monsite”); It works but it lasts too much time before displaying the page in the relevant language page thanks to the wix language app
So here is my problem: I thought I could redirect visitors to the homepage according to their language taking into account the previous page. I use the function referrer and tried this code but it doesn’t work as I could guess… Is there a solution to get back faster to the relevant homepage?
If you can help me, thank you very much in advance
You are missing the username part of your site url
export function shape3_click(event, $w) {
let referrer = wixWindow.referrer;
//replace username with your wix username
if (referrer === "https://username.wixsite.com/monsite/fr") {
wixLocation.to("https://username.wixsite.com/monsite/fr");
}
if (referrer === "https://username.wixsite.com/monsite/es"){
wixLocation.to("https://username.wixsite.com/monsite/es");
}
if (referrer === "https://username.wixsite.com/monsite/en"){
wixLocation.to("https://username.wixsite.com/monsite/en");
}
}