Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

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

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top