Yes, you can.
Browsers may have no language set, or several in order of preference.
Here is some code I wrote for our application, which sets the language to the first language listed in the browser which is considered "valid" (i.e. I have translations in)
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langs = split(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
// Scan until we find an acceptable language
foreach ($langs as $lang) {
// Chop of anything after the first two chars (example: en-GB;q=0.5)
$lang = substr($lang,0,2);
$lang = strtolower($lang); // lowercase it.
if (IsValidLanguage($lang)) {
SetLanguage($lang);
return;
}
}
}
Mark