Visitor System Foreign Language Detection

  Air_Man 12:46 06 Apr 2005

I would like to be able to detect which language a visitor's system is using and display appropriate English/French/Russian etc. content on the home page. There will be links for the visitor to click to change language, but it would be nice to welcome the visitor in their own language from the minute the page loads. While I appreciate that the solution may not be foolproof, I am sure I should be able to do this with standard HTML and/or Javascript but have had not luck searching the web in general.

So I thought I'd consult the experts. Any advice anyone?

  harristweed 14:11 06 Apr 2005

try here

click here

  Air_Man 06:13 07 Apr 2005

Thx Harristweed. I'll give it a go today and let you know how I get on.

  Air_Man 08:05 09 Apr 2005

the solution was a bit over complicated, so I dug around a bit more. In the end I found the navigator.userLanguage object, and since I only need to check three languages, used the code below:

function showLang(){

var lang = this.navigator.userLanguage.toLowerCase();
lang2 = lang.substring(0,2);
if(lang2 == "en"){EnglishTop()};
if(lang2 == "fr"){FrenchTop()};
if(lang2 == "it"){ItalianTop()};


Thanx for your help.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

HP Envy x2 review: Hands-on

How Sketch and InVision have revolutionised our design workflow

The best tech gifts for Christmas 2017

Les meilleurs jeux de société (2017)