protected static function _preferredAction($request) {
		$result = [];
		$regex  = "/^\s*(?P<locale>\w\w(?:[-]\w\w)?)(?:;q=(?P<quality>(0|1|0\.\d+)))?\s*$/";

		foreach (explode(',', $request->env('HTTP_ACCEPT_LANGUAGE')) as $part) {
			if (preg_match($regex, $part, $matches)) {
				$locale = static::canonicalize($matches['locale']);
				$quality = isset($matches['quality']) ? $matches['quality'] : 1;
				$result[$quality][] = $locale;
			}
		}
		krsort($result);

		return array_reduce($result, function($carry, $item) {
			return array_merge($carry, array_values($item));
		}, []);
	}
protected static function _preferredAction($request) {
		$result = [];
		$regex  = "/^\s*(?P<locale>\w\w(?:[-]\w\w)?)(?:;q=(?P<quality>(0|1|0\.\d+)))?\s*$/";

		foreach (explode(',', $request->env('HTTP_ACCEPT_LANGUAGE')) as $part) {
			if (preg_match($regex, $part, $matches)) {
				$locale = static::canonicalize($matches['locale']);
				$quality = isset($matches['quality']) ? $matches['quality'] : 1;
				$result[$quality][] = $locale;
			}
		}
		krsort($result);

		return array_reduce($result, function($carry, $item) {
			return array_merge($carry, array_values($item));
		}, []);
	}
protected static function _preferredAction ( $ request ) { $ result = [ ] ; $ regex = "/^\s*(?P<locale>\w\w(?:[-]\w\w)?)(?:;q=(?P<quality>(0|1|0\.\d+)))?\s*$/" ; foreach ( explode ( ',' , $ request -> env ( 'HTTP_ACCEPT_LANGUAGE' ) ) as $ part ) { if ( preg_match ( $ regex , $ part , $ matches ) ) { $ locale = static :: canonicalize ( $ matches [ 'locale' ] ) ; $ quality = isset ( $ matches [ 'quality' ] ) ? $ matches [ 'quality' ] : 1 ; $ result [ $ quality ] [ ] = $ locale ; } } krsort ( $ result ) ; return array_reduce ( $ result , function ( $ carry , $ item ) { return array_merge ( $ carry , array_values ( $ item ) ) ; } , [ ] ) ; }
Detects preferred locales from an action request by looking at the
`'Accept-Language'` header as described by RFC 2616, section 14.4.

@link http://www.ietf.org/rfc/rfc2616.txt
@param \lithium\action\Request $request
@return array Preferred locales in their canonical form (i.e. `'fr_CA'`).
Detects preferred locales from an action request by looking at the Accept - Language header as described by RFC 2616 section 14 . 4 .