behaviors/MlApplicationBehavior.php
protected function setLanguage()
	{
		$matches = array();
		if ($this->owner->user->hasState('__locale'))
			$language = $this->owner->user->getState('__locale');
		else if (preg_match('/^\/([a-z]{2}(?:_[a-z]{2})?)\//i',
			substr($this->owner->request->url, strlen($this->owner->baseUrl)), $matches) !== false
			&& isset($matches[1], $this->languages[$matches[1]]))
			$language = $matches[1];
		else
			$language = $this->defaultLanguage;

		$this->owner->language = $language;
	}
protected function setLanguage()
	{
		$matches = array();
		if ($this->owner->user->hasState('__locale'))
			$language = $this->owner->user->getState('__locale');
		else if (preg_match('/^\/([a-z]{2}(?:_[a-z]{2})?)\//i',
			substr($this->owner->request->url, strlen($this->owner->baseUrl)), $matches) !== false
			&& isset($matches[1], $this->languages[$matches[1]]))
			$language = $matches[1];
		else
			$language = $this->defaultLanguage;

		$this->owner->language = $language;
	}
protected function setLanguage ( ) { $ matches = array ( ) ; if ( $ this -> owner -> user -> hasState ( '__locale' ) ) $ language = $ this -> owner -> user -> getState ( '__locale' ) ; else if ( preg_match ( '/^\/([a-z]{2}(?:_[a-z]{2})?)\//i' , substr ( $ this -> owner -> request -> url , strlen ( $ this -> owner -> baseUrl ) ) , $ matches ) !== false && isset ( $ matches [ 1 ] , $ this -> languages [ $ matches [ 1 ] ] ) ) $ language = $ matches [ 1 ] ; else $ language = $ this -> defaultLanguage ; $ this -> owner -> language = $ language ; }
Sets the application language from a user state if applicable.
Sets the application language from a user state if applicable .