getLanguageService(); $coreLabels = [ 'csh_tooltip_loading' => $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:csh_tooltip_loading') ]; $generatedLabels = []; $generatedLabels['core'] = $coreLabels; $code = 'TYPO3.LLL = ' . json_encode($generatedLabels) . ';'; $filePath = 'typo3temp/assets/js/backend-' . sha1($code) . '.js'; if (!file_exists(PATH_site . $filePath)) { // writeFileToTypo3tempDir() returns NULL on success (please double-read!) $error = GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filePath, $code); if ($error !== null) { throw new \RuntimeException('Locallang JS file could not be written to ' . $filePath . '. Reason: ' . $error, 1446118286); } } $pageRenderer->addJsFile('../' . $filePath); } } /** * Returns LanguageService * * @return \TYPO3\CMS\Core\Localization\LanguageService */ protected function getLanguageService() { return $GLOBALS['LANG']; } }