public function getLanguage(string $default = null): string {
    $language = $default ?: 'en';

    if (TYPO3_MODE === 'FE') {
      if (isset($GLOBALS['TSFE']->lang)) {
        $language = $GLOBALS['TSFE']->lang;
      }
    } elseif (is_object($GLOBALS['LANG'])) {
      if (isset($GLOBALS['LANG']->lang)) {
        $language = $GLOBALS['LANG']->lang;
      }
    }

    // if (TYPO3_MODE === 'FE') {
    //   if (isset($GLOBALS['TSFE']->config['config']['language'])) {
    //     $language = $GLOBALS['TSFE']->config['config']['language'];
    //   }
    // } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) {
    //   $language = $GLOBALS['BE_USER']->uc['lang'];
    // }

    return $language;
  }
public function getLanguage(string $default = null): string {
    $language = $default ?: 'en';

    if (TYPO3_MODE === 'FE') {
      if (isset($GLOBALS['TSFE']->lang)) {
        $language = $GLOBALS['TSFE']->lang;
      }
    } elseif (is_object($GLOBALS['LANG'])) {
      if (isset($GLOBALS['LANG']->lang)) {
        $language = $GLOBALS['LANG']->lang;
      }
    }

    // if (TYPO3_MODE === 'FE') {
    //   if (isset($GLOBALS['TSFE']->config['config']['language'])) {
    //     $language = $GLOBALS['TSFE']->config['config']['language'];
    //   }
    // } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) {
    //   $language = $GLOBALS['BE_USER']->uc['lang'];
    // }

    return $language;
  }
public function getLanguage ( string $ default = null ) : string { $ language = $ default ? : 'en' ; if ( TYPO3_MODE === 'FE' ) { if ( isset ( $ GLOBALS [ 'TSFE' ] -> lang ) ) { $ language = $ GLOBALS [ 'TSFE' ] -> lang ; } } elseif ( is_object ( $ GLOBALS [ 'LANG' ] ) ) { if ( isset ( $ GLOBALS [ 'LANG' ] -> lang ) ) { $ language = $ GLOBALS [ 'LANG' ] -> lang ; } } // if (TYPO3_MODE === 'FE') { //   if (isset($GLOBALS['TSFE']->config['config']['language'])) { //     $language = $GLOBALS['TSFE']->config['config']['language']; //   } // } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) { //   $language = $GLOBALS['BE_USER']->uc['lang']; // } return $ language ; }
Gets the current language.

@param string $default The default language, defaults to `en`
@return string The current language if available, otherwise the default one
Gets the current language .