/** * Wrapper function for getting localizations in frontend and backend * * @param string $key: The locallang key to translate * @param boolean $hsc: Should the result be htmlspecialchar()'ed? * @param string $default: Default return value if no translation is available * * @return string The translated string or the given key on failure */ public static function getLL($key, $hsc = FALSE, $default = '') { // Set initial output to default value. $translated = (string) $default; // Load common locallang file. if (empty(self::$locallang)) { $file = t3lib_extMgm::extPath(self::$extKey, 'common/locallang.xml'); if (TYPO3_MODE === 'FE') { self::$locallang = $GLOBALS['TSFE']->readLLfile($file); } elseif (TYPO3_MODE === 'BE') { self::$locallang = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); } elseif (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_helper->getLL(' . $key . ', ' . $default . ', [' . ($hsc ? 'TRUE' : 'FALSE') . '])] Unexpected TYPO3_MODE "' . TYPO3_MODE . '"', self::$extKey, SYSLOG_SEVERITY_ERROR); } } // Get translation. if (!empty(self::$locallang['default'][$key])) { if (TYPO3_MODE === 'FE') { $translated = $GLOBALS['TSFE']->getLLL($key, self::$locallang); } elseif (TYPO3_MODE === 'BE') { $translated = $GLOBALS['LANG']->getLLL($key, self::$locallang, FALSE); } elseif (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_helper->getLL(' . $key . ', ' . $default . ', [' . ($hsc ? 'TRUE' : 'FALSE') . '])] Unexpected TYPO3_MODE "' . TYPO3_MODE . '"', self::$extKey, SYSLOG_SEVERITY_ERROR); } } // Escape HTML characters if applicable. if ($hsc) { $translated = htmlspecialchars($translated); } return $translated; }