Rodney, below is a function I use to test if visitor prefers Croatian (hr) over Serbian (sr) when she visits Prevod.org web pages to provide Latin transcription of the pages.
function header_language_compare($default = 'sr', $comparewith = 'hr') { $languages=split(',',$_SERVER["HTTP_ACCEPT_LANGUAGE"]); $qdefault=0; $qcompare=0; foreach ($languages as $lang) { if (ereg("^$default$",$lang,$regs)) { $qdefault=1; } elseif (ereg("^$comparewith$",$lang,$regs)) { $qcompare=1; } elseif (ereg("^$default;[ ]*q=([0-9.]+)$",$lang,$regs)) { $qdefault=$regs[1]; } elseif (ereg("^$comparewith;[ ]*q=([0-9.]+)$",$lang,$regs)) { $qcompare=$regs[1]; } } if ($qcompare>$qdefault) return 1; else return 0; }
If "hr" is more desireable than "sr" (i.e. there's no "sr" at all, or it has lower "quality" than "hr") according to "Accept-Language" header, this function will return 1, otherwise 0. You might want to use something similar to compare 'en' and 'sq', letting most people default to 'en' for your blog.