src/Middleware/DetectLocaleMiddleware.php
protected function getPersistLocale(HTTPRequest $request)
    {
        $key = $this->getPersistKey();

        // Skip persist if key is unset
        if (empty($key)) {
            return null;
        }

        // check session then cookies
        $session = $request->getSession();
        if ($session->isStarted() && ($locale = $session->get($key))) {
            return $locale;
        }

        if (static::config()->get('persist_cookie') && ($locale = Cookie::get($key))) {
            return $locale;
        }

        return null;
    }
protected function getPersistLocale(HTTPRequest $request)
    {
        $key = $this->getPersistKey();

        // Skip persist if key is unset
        if (empty($key)) {
            return null;
        }

        // check session then cookies
        $session = $request->getSession();
        if ($session->isStarted() && ($locale = $session->get($key))) {
            return $locale;
        }

        if (static::config()->get('persist_cookie') && ($locale = Cookie::get($key))) {
            return $locale;
        }

        return null;
    }
protected function getPersistLocale ( HTTPRequest $ request ) { $ key = $ this -> getPersistKey ( ) ; // Skip persist if key is unset if ( empty ( $ key ) ) { return null ; } // check session then cookies $ session = $ request -> getSession ( ) ; if ( $ session -> isStarted ( ) && ( $ locale = $ session -> get ( $ key ) ) ) { return $ locale ; } if ( static :: config ( ) -> get ( 'persist_cookie' ) && ( $ locale = Cookie :: get ( $ key ) ) ) { return $ locale ; } return null ; }
Gets the locale currently set within either the session or cookie.

@param HTTPRequest $request
@return null|string The locale, if available
Gets the locale currently set within either the session or cookie .