// Read browser language 
$foo = $_SERVER['HTTP_ACCEPT_LANGUAGE']; 
// Only need the first two characters 
$lang = substr($foo,0,2); 
// Passing the parameter $lang to the template 
 
$smarty->assign('lang', $lang);