xlf: /** @var $languageFactory LocalizationFactory */ $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class); $LOCAL_LANG = $languageFactory->getParsedData('EXT:sitebase/Resources/Private/Language/locallang.xlf', 'en', 'utf-8'); xml: public function getTranslate($file, $key, $lang) { $xml = GeneralUtility::xml2array(file_get_contents($file)); if (isset($xml['data'][$lang][$key])) { return $xml['data'][$lang][$key]; } else { return $xml['data']['default'][$key]; } }