public static function getAcceptableLanguages( $rawList = false ) {
		// Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang
		// Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header

		// @codeCoverageIgnoreStart
		if ( $rawList === false ) {
			$rawList = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ?
				$_SERVER['HTTP_ACCEPT_LANGUAGE'] :
				'';
		}
		// @codeCoverageIgnoreEnd

		// Return the language codes in lower case
		$rawList = strtolower( $rawList );

		// The list of elements is separated by comma and optional LWS
		// Extract the language-range and, if present, the q-value
		$lang_parse = null;
		preg_match_all(
			'/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/',
			$rawList,
			$lang_parse
		);

		if ( !count( $lang_parse[1] ) ) {
			return [];
		}

		$langcodes = $lang_parse[1];
		$qvalues = $lang_parse[4];
		$indices = range( 0, count( $lang_parse[1] ) - 1 );

		// Set default q factor to 1
		foreach ( $indices as $index ) {
			if ( $qvalues[$index] === '' ) {
				$qvalues[$index] = 1;
			} elseif ( $qvalues[$index] == 0 ) {
				unset( $langcodes[$index], $qvalues[$index], $indices[$index] );
			} else {
				$qvalues[$index] = floatval( $qvalues[$index] );
			}
		}

		// Sort list. First by $qvalues, then by order. Reorder $langcodes the same way
		array_multisort( $qvalues, SORT_DESC, SORT_NUMERIC, $indices, $langcodes );

		// Create a list like "en" => 0.8
		$langs = array_combine( $langcodes, $qvalues );

		return $langs;
	}