public function detect(Request $request, Response $response = null)
	{
		$localeId = null;

		/* @var $detector Detector\DetectorInterface */
		foreach ($this->detectors as $detector) {
			
			$localeId = $detector->detect($request);
			
			if ( ! empty($localeId)) {
				
				if ($this->hasLocale($localeId) && ($this->processInactive || $this->isActive($localeId))) {
					$this->setCurrent($localeId);
					break;
				}
			}
		}

		if (empty($localeId)) {
			throw new Exception\RuntimeException("Could not detect locale for request '{$request->getBaseUrl()}'");
		}

		/* @var $storage Storage\StorageInterface */

		// @FIXME: there is no response object here.
		foreach ($this->storages as $storage) {
			$storage->store($request, $response, $localeId);
		}
	}
public function detect(Request $request, Response $response = null)
	{
		$localeId = null;

		/* @var $detector Detector\DetectorInterface */
		foreach ($this->detectors as $detector) {
			
			$localeId = $detector->detect($request);
			
			if ( ! empty($localeId)) {
				
				if ($this->hasLocale($localeId) && ($this->processInactive || $this->isActive($localeId))) {
					$this->setCurrent($localeId);
					break;
				}
			}
		}

		if (empty($localeId)) {
			throw new Exception\RuntimeException("Could not detect locale for request '{$request->getBaseUrl()}'");
		}

		/* @var $storage Storage\StorageInterface */

		// @FIXME: there is no response object here.
		foreach ($this->storages as $storage) {
			$storage->store($request, $response, $localeId);
		}
	}
public function detect ( Request $ request , Response $ response = null ) { $ localeId = null ; /* @var $detector Detector\DetectorInterface */ foreach ( $ this -> detectors as $ detector ) { $ localeId = $ detector -> detect ( $ request ) ; if ( ! empty ( $ localeId ) ) { if ( $ this -> hasLocale ( $ localeId ) && ( $ this -> processInactive || $ this -> isActive ( $ localeId ) ) ) { $ this -> setCurrent ( $ localeId ) ; break ; } } } if ( empty ( $ localeId ) ) { throw new Exception \ RuntimeException ( "Could not detect locale for request '{$request->getBaseUrl()}'" ) ; } /* @var $storage Storage\StorageInterface */ // @FIXME: there is no response object here. foreach ( $ this -> storages as $ storage ) { $ storage -> store ( $ request , $ response , $ localeId ) ; } }
Detects current locale

@param Request $request
@param Response | null $response

@throws Exception if locale was not detected
Detects current locale