How To Automatically Detect and Change Your Website Language

Do you know that it is possible to automatically detect and change your website language based upon the local language used by your site visitors?

In this post I’m going to explain how this can be done.

How Can You Know What Language A Person Wants?

Well, it’s very simple really,  when you install software you also set the langauge you would like to use. And the web browser we install has our desired and default language set.  Here is a screen shot of my chrome config, as you can see my base language is set to English – United Kingdom.

Click for full size image
Click for full size image

Using javascript we can get the default language and use that to display our website automatically in their preferred language to that visitor.

Do I Need To Code This Up?

You can if you want, but I use a piece of software called WPML on all my multi language builds.  This software has this functionality built right into it.

From the language setup pages we can set the site to automatically redirect based upon browser language.  Why code your own solution when there is one out there already.

Click for full size image
Click for full size image

Why Do This?

As with all multi language work the “WHY” is to make your site as understandable as possible to your site visitors.

Say I speak French and I come to your English language website, already there is a barrier to entry based upon my ability to read and speak English.  If you tear down that barrier and present me with your site in French I’m already engaged more.

It Will Only Work If You Have The Correct Languages Translated.

This is not magic, your site will only redirect if you have the appropriate languages installed and translated.

This means you need the exact language specification, my browser is set to en-gb, so you would need en-gb as a language not en-us or any other version of English.

This may seem a small point but if you install FR for French and your visitor has fr-ca or French Canadian as their language, your redirect will not work.

It’s Not Just Languages It’s For Territories Too.

You can also use this functionality to redirect to a different territory based on their language settings.

Say I’m a US based company selling into Australia and I have different copy for that market, I could install en-us and en-au as my languages and automatically redirect to a different English version based upon location.  This allows me to add different prices / copy etc to the Australian site.

Wrap Up

Getting your message to your site visitor in the most convenient way is the main reason to have a multi language site, why not remove that need to click over to their desired language with an automatic browser detection.

If you need help automatically redirecting your site based upon language, why not get a quote from us.


Leave a Reply

Your email address will not be published. Required fields are marked *