1

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.

4 Answers 4

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

1

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

Comments

0

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.