views:

406

answers:

4

I'm thinking of doing multiple language versions of my website (e.g. English and German). I'd like to offer a reasonable default based on the user's language.

What's the easiest and least obstrusive way to do that?

EDIT: The ideal solution would be not to use any server-side technology, but to encode everything in the html-files. Currently, I have a starting page that auto-forwards to the main page. If possible, I'd like to make that a bit "smarter" so that it forwards to either the German or the English version.

+1  A: 

The easiest way is to check the Accept-Language header.

+2  A: 

The easiest way would be to parse the Accept-Language header field.

Gumbo
A: 

As Gumbo pointed out (you could use the Accept-Language HTTP request header - if it was sent by the user's client) but you will not have direct access to that from Javascript. you will need some help from your server side platform (i.e. PHP, ASP.NET or whatever else you're using)

+1  A: 

I believe properties are either navigator.language or navigator.userLanguage.

Andrew