public function getLanguage(bool $short = false) : ? string
    {
        $request = new Request();

        if ($this->isLoggedIn() && !empty($this->language)) {
            $lang = !$short ? strtolower($this->language) . '_' . $this->language : strtolower($this->language);
        } elseif ($this->getDI()->getSession()->has('requestLanguage')) {
            $lang = !$short ? $this->getDI()->getSession()->get('requestLanguage') . '_' . strtoupper($this->getDI()->getSession()->get('requestLanguage')) : strtolower($this->getDI()->getSession()->get('requestLanguage'));
        } else {
            if (!is_null($request->getServer('HTTP_ACCEPT_LANGUAGE'))) {
                $lang = !$short ? Locale::acceptFromHttp($request->getServer('HTTP_ACCEPT_LANGUAGE')) : strtolower(Locale::acceptFromHttp($request->getServer('HTTP_ACCEPT_LANGUAGE')));
            } else {
                $lang = null;
            }
        }

        return $lang;
    }
public function getLanguage(bool $short = false) : ? string
    {
        $request = new Request();

        if ($this->isLoggedIn() && !empty($this->language)) {
            $lang = !$short ? strtolower($this->language) . '_' . $this->language : strtolower($this->language);
        } elseif ($this->getDI()->getSession()->has('requestLanguage')) {
            $lang = !$short ? $this->getDI()->getSession()->get('requestLanguage') . '_' . strtoupper($this->getDI()->getSession()->get('requestLanguage')) : strtolower($this->getDI()->getSession()->get('requestLanguage'));
        } else {
            if (!is_null($request->getServer('HTTP_ACCEPT_LANGUAGE'))) {
                $lang = !$short ? Locale::acceptFromHttp($request->getServer('HTTP_ACCEPT_LANGUAGE')) : strtolower(Locale::acceptFromHttp($request->getServer('HTTP_ACCEPT_LANGUAGE')));
            } else {
                $lang = null;
            }
        }

        return $lang;
    }
public function getLanguage ( bool $ short = false ) : ? string { $ request = new Request ( ) ; if ( $ this -> isLoggedIn ( ) && ! empty ( $ this -> language ) ) { $ lang = ! $ short ? strtolower ( $ this -> language ) . '_' . $ this -> language : strtolower ( $ this -> language ) ; } elseif ( $ this -> getDI ( ) -> getSession ( ) -> has ( 'requestLanguage' ) ) { $ lang = ! $ short ? $ this -> getDI ( ) -> getSession ( ) -> get ( 'requestLanguage' ) . '_' . strtoupper ( $ this -> getDI ( ) -> getSession ( ) -> get ( 'requestLanguage' ) ) : strtolower ( $ this -> getDI ( ) -> getSession ( ) -> get ( 'requestLanguage' ) ) ; } else { if ( ! is_null ( $ request -> getServer ( 'HTTP_ACCEPT_LANGUAGE' ) ) ) { $ lang = ! $ short ? Locale :: acceptFromHttp ( $ request -> getServer ( 'HTTP_ACCEPT_LANGUAGE' ) ) : strtolower ( Locale :: acceptFromHttp ( $ request -> getServer ( 'HTTP_ACCEPT_LANGUAGE' ) ) ) ; } else { $ lang = null ; } } return $ lang ; }
get the user language

@return string
get the user language