code: protected static function httpAcceptLanguage()
  	{
  		$arrAccepted = array();
  		$arrLanguages = array();
  
  		// The implementation differs from the original implementation and also works with .jp browsers
  		preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $arrAccepted);
  
  		// Remove all invalid locales
  		foreach ($arrAccepted[1] as $v)
  		{
  			$chunks = explode('-', $v);
  
  			// Language plus dialect, e.g. en-US or fr-FR
  			if (isset($chunks[1]))
  			{
  				$locale = $chunks[0] . '-' . strtoupper($chunks[1]);
  
  				if (preg_match('/^[a-z]{2}(-[A-Z]{2})?$/', $locale))
  				{
  					$arrLanguages[] = $locale;
  				}
  			}
  
  			$locale = $chunks[0];
  
  			// Language only, e.g. en or fr (see #29)
  			if (preg_match('/^[a-z]{2}$/', $locale))
  			{
  				$arrLanguages[] = $locale;
  			}
  		}
  
  		return \array_slice(array_unique($arrLanguages), 0, 8);
  	}
docs: Return the first eight accepted languages as array
  
  @return array The languages array
  
  @author Leo Unglaub <https://github.com/LeoUnglaub>