Return to Snippet

Revision: 3308
at July 5, 2007 08:08 by oriolgual


Initial Code
function getIdiomaNavegador ()
	{
		if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
		{
			$idiomes = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
			for($i = 0;$i < count($idiomes);$i++)
			{				
				if (strlen($idiomes[$i]) > 2) $idiomes[$i] = substr($idiomes[$i], 0, 2);
				if (in_array($idiomes[$i], $this->IDIOMES_COMPARTIR))
				{
					$idioma = array_keys($this->IDIOMES_COMPARTIR, $idiomes[$i]);
					return ($idioma[0] + 1);
				}
			}
		}
		return 1;

Initial URL


Initial Description


Initial Title
Obtenir idioma del navegador

Initial Tags


Initial Language
PHP