Jump to content

How to detect browser's language and redirect to the appropriate language homepage

Recommended Posts

Guest
Posted (edited)

Hello.  I am wondering how I can detect the user's locale on homepage load, and immediately redirect visitors to the appropriate page in their language without the requirement to select their preferred language.

The website structure would be similar to that in Creating a multilingual site in Squarespace § Structure your pages, with two folders with the same pages and structure but different languages, but without the language chooser in the homepage as described in (1).  Instead, I suppose I could embed some JavaScript in the homepage to check the navigator.language property and redirect visitors accordingly.  Therefore, The user would never see the de jure homepage but a de facto homepage in their language.

Is this possible?  Or is there a better way to achieve this?  If so, how can it be implemented into a Squarespace website?  I am comfortable with code, so I am more than happy to dive into it.  I am also aware of the Weglot integration, but have decided not to use it due to strict translation requirements -- and I am more than happy to translate the content myself.

Thank you very much!

Edited by Guest
Amend title
Link to comment
  • Guest changed the title to How to detect browser's language and redirect to the appropriate language homepage
  • Replies 0
  • Created
  • Last Reply

Popular Days

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.