private function getByExtensionName($extensionName)
    {
        if ($extensionName === '') {
            throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489578);
        }

        if (!ExtensionManagementUtility::isLoaded($extensionName)) {
            throw new \BadMethodCallException(
                'The extension with the name "' . $extensionName . '" is not loaded.',
                1331489598
            );
        }

        if (!isset($this->translators[$extensionName])) {
            $localizedLabels = $this->getLocalizedLabelsFromFile($extensionName);
            // Overrides the localized labels with labels from TypoScript only
            // in the front end.

            if (($this->getFrontEndController() !== null)
                && isset($localizedLabels[$this->languageKey])
                && is_array($localizedLabels[$this->languageKey])
            ) {
                $labelsFromTyposcript = $this->getLocalizedLabelsFromTypoScript($extensionName);

                foreach ($labelsFromTyposcript as $labelKey => $labelFromTyposcript) {
                    $localizedLabels[$this->languageKey][$labelKey][0]['target'] = $labelFromTyposcript;
                }
            }

            /** @var \Tx_Oelib_Translator $translator */
            $translator = GeneralUtility::makeInstance(
                \Tx_Oelib_Translator::class,
                $this->languageKey,
                $this->alternativeLanguageKey,
                $localizedLabels
            );
            $this->translators[$extensionName] = $translator;
        }

        return $this->translators[$extensionName];
    }
private function getByExtensionName($extensionName)
    {
        if ($extensionName === '') {
            throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489578);
        }

        if (!ExtensionManagementUtility::isLoaded($extensionName)) {
            throw new \BadMethodCallException(
                'The extension with the name "' . $extensionName . '" is not loaded.',
                1331489598
            );
        }

        if (!isset($this->translators[$extensionName])) {
            $localizedLabels = $this->getLocalizedLabelsFromFile($extensionName);
            // Overrides the localized labels with labels from TypoScript only
            // in the front end.

            if (($this->getFrontEndController() !== null)
                && isset($localizedLabels[$this->languageKey])
                && is_array($localizedLabels[$this->languageKey])
            ) {
                $labelsFromTyposcript = $this->getLocalizedLabelsFromTypoScript($extensionName);

                foreach ($labelsFromTyposcript as $labelKey => $labelFromTyposcript) {
                    $localizedLabels[$this->languageKey][$labelKey][0]['target'] = $labelFromTyposcript;
                }
            }

            /** @var \Tx_Oelib_Translator $translator */
            $translator = GeneralUtility::makeInstance(
                \Tx_Oelib_Translator::class,
                $this->languageKey,
                $this->alternativeLanguageKey,
                $localizedLabels
            );
            $this->translators[$extensionName] = $translator;
        }

        return $this->translators[$extensionName];
    }
private function getByExtensionName ( $ extensionName ) { if ( $ extensionName === '' ) { throw new \ InvalidArgumentException ( 'The parameter $extensionName must not be empty.' , 1331489578 ) ; } if ( ! ExtensionManagementUtility :: isLoaded ( $ extensionName ) ) { throw new \ BadMethodCallException ( 'The extension with the name "' . $ extensionName . '" is not loaded.' , 1331489598 ) ; } if ( ! isset ( $ this -> translators [ $ extensionName ] ) ) { $ localizedLabels = $ this -> getLocalizedLabelsFromFile ( $ extensionName ) ; // Overrides the localized labels with labels from TypoScript only // in the front end. if ( ( $ this -> getFrontEndController ( ) !== null ) && isset ( $ localizedLabels [ $ this -> languageKey ] ) && is_array ( $ localizedLabels [ $ this -> languageKey ] ) ) { $ labelsFromTyposcript = $ this -> getLocalizedLabelsFromTypoScript ( $ extensionName ) ; foreach ( $ labelsFromTyposcript as $ labelKey => $ labelFromTyposcript ) { $ localizedLabels [ $ this -> languageKey ] [ $ labelKey ] [ 0 ] [ 'target' ] = $ labelFromTyposcript ; } } /** @var \Tx_Oelib_Translator $translator */ $ translator = GeneralUtility :: makeInstance ( \ Tx_Oelib_Translator :: class , $ this -> languageKey , $ this -> alternativeLanguageKey , $ localizedLabels ) ; $ this -> translators [ $ extensionName ] = $ translator ; } return $ this -> translators [ $ extensionName ] ; }
Gets a Translator by its extension name.

@param string $extensionName
the extension name to get the Translator for, must not be empty, the corresponding extension must be
loaded

@return \Tx_Oelib_Translator the Translator for the specified extension
name
Gets a Translator by its extension name .