public static function preferred($request, $available = null) {
		if (is_array($request)) {
			$result = $request;
		} elseif ($request instanceof ActionRequest) {
			$result = static::_preferredAction($request);
		} elseif ($request instanceof ConsoleRequest) {
			$result = static::_preferredConsole($request);
		} else {
			return null;
		}
		if (!$available) {
			return array_shift($result);
		}
		foreach ((array) $result as $locale) {
			if ($match = static::lookup($available, $locale)) {
				return $match;
			}
		}
	}
public static function preferred($request, $available = null) {
		if (is_array($request)) {
			$result = $request;
		} elseif ($request instanceof ActionRequest) {
			$result = static::_preferredAction($request);
		} elseif ($request instanceof ConsoleRequest) {
			$result = static::_preferredConsole($request);
		} else {
			return null;
		}
		if (!$available) {
			return array_shift($result);
		}
		foreach ((array) $result as $locale) {
			if ($match = static::lookup($available, $locale)) {
				return $match;
			}
		}
	}
public static function preferred ( $ request , $ available = null ) { if ( is_array ( $ request ) ) { $ result = $ request ; } elseif ( $ request instanceof ActionRequest ) { $ result = static :: _preferredAction ( $ request ) ; } elseif ( $ request instanceof ConsoleRequest ) { $ result = static :: _preferredConsole ( $ request ) ; } else { return null ; } if ( ! $ available ) { return array_shift ( $ result ) ; } foreach ( ( array ) $ result as $ locale ) { if ( $ match = static :: lookup ( $ available , $ locale ) ) { return $ match ; } } }
Determines the preferred locale from a request or array. Optionally negotiates
the preferred locale with available locales.

@see lithium\g11n\Locale::_preferredAction()
@see lithium\g11n\Locale::_preferredConsole()
@see lithium\g11n\Locale::lookup()
@param object|array $request An action or console request object or an array of locales.
@param array $available A list of locales to negotiate the preferred locale with.
@return string The preferred locale in its canonical form (i.e. `'fr_CA'`).
@todo Rewrite this to remove hard-coded class names.
Determines the preferred locale from a request or array . Optionally negotiates the preferred locale with available locales .