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;
    }