I use the following PHP script as index for my website.
This script should include a specific page depending on the browser\'s language (automatically detected).
Quick and simple:
$language = trim(substr( strtok(strtok($_SERVER['HTTP_ACCEPT_LANGUAGE'], ','), ';'), 0, 5));
NOTE: The first language code is what is being used by the browser, the rest are other languages the user has setup in the browser.
Some languages have a region code, eg. en-GB, others just have the language code, eg. sk.
If you just want the language and not the region (eg. en, fr, es, etc.), you can use:
$language =substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);