English & german: dual-language site

Hello,

I’m in the process of providing a proposal for a two language site, English and German website. I’ve done a quick test where I’ll create a folder for both EN and DE with all relevant pages etc. (Shared link below)

https://preview.webflow.com/preview/botamentwetrooms?preview=2d558d249a599166b5f18c6578d7d29f

As the domain name will be a .com and needs to point to a homepage. Is there any way this can be by-passed and depending on whether you are browsing from the UK or Germany it will land on the appropriate homepage for that language?

regards
David

We don’t have internationalization built in right now, but you could a little custom script to the <head> to redirect based on browser’s language:

<script>
var language = navigator.language || navigator.browserLanguage;
if (language == 'en-US') {
  window.location = '/us/home';
}
<script>

Paste this in Home > Page Settings > Header Code

<script>
var lang = navigator.language || navigator.browserLanguage;
if (lang.indexOf('de') >= 0) {
  location.replace('/de/home');
}
else {
  location.replace('/en/home');
}
</script>

Also, feel free to contact me for further code help and/or customization of third-party plugins

2 Likes

Thanks Samuel, not exactly sure where to paste the script?

Scroll down to “Individual Page Head Code”.

Yeah, I’ve done that. But it still lands on the splash page?

Sorry, please replace the script again. There was a typo.

The script will redirect users based on their browser language.

Hi Samuel, yeah that worked!

This topic was automatically closed after 60 days. New replies are no longer allowed.