2 namespace TYPO3\CMS\Core\Localization\Parser;
79 if (!file_exists($this->cacheFileName)) {
96 foreach ($LOCAL_LANG as &$keysLabels) {
97 foreach ($keysLabels as &$label) {
117 $this->csConvObj =
$GLOBALS[
'LANG']->csConvObj;
119 $this->csConvObj =
$GLOBALS[
'TSFE']->csConvObj;
135 $LOCAL_LANG = array();
138 if (!is_array($LOCAL_LANG)) {
140 throw new \RuntimeException(
'TYPO3 Fatal Error: "' . $fileName .
'" is no TYPO3 language file!', 1308898491);
144 if (is_array($LOCAL_LANG[
'default']) && $this->targetCharset !==
'utf-8') {
145 foreach ($LOCAL_LANG[
'default'] as &$labelValue) {
146 $labelValue = $this->csConvObj->conv($labelValue,
'utf-8', $this->targetCharset);
150 if ($languageKey !==
'default' && is_array($LOCAL_LANG[$languageKey]) && $this->sourceCharset !== $this->targetCharset) {
151 foreach ($LOCAL_LANG[$languageKey] as &$labelValue) {
152 $labelValue = $this->csConvObj->conv($labelValue, $this->sourceCharset, $this->targetCharset);
157 if (isset($LOCAL_LANG[$languageKey])) {
158 $serContent = array(
'origFile' => $this->hashSource,
'LOCAL_LANG' => array(
'default' => $LOCAL_LANG[
'default'], $languageKey => $LOCAL_LANG[$languageKey]));
160 $serContent = array(
'origFile' => $this->hashSource,
'LOCAL_LANG' => array(
'default' => $LOCAL_LANG[
'default']));
164 throw new \RuntimeException(
'TYPO3 Fatal Error: "' . $res, 1308898501);
179 $this->cacheFileName = PATH_site .
'typo3temp/llxml/' . substr(basename($sourcePath), 10, 15) .
'_' .
GeneralUtility::shortMD5($this->hashSource) .
'.' . $languageKey .
'.' . $this->targetCharset .
'.cache';
189 $serContent = (array)unserialize(file_get_contents($this->cacheFileName));
190 $LOCAL_LANG = $serContent[
'LOCAL_LANG'];
191 return (array)$LOCAL_LANG;
214 $this->sourceCharset = $this->csConvObj->parse_charset($this->csConvObj->charSetArray[$languageKey] ?:
'utf-8');
216 $this->targetCharset = $this->csConvObj->parse_charset($charset);
218 $this->targetCharset =
'utf-8';
232 if (!$this->
isWithinWebRoot($sourcePath) || !@is_file($sourcePath) || !$languageKey) {
233 throw new \RuntimeException(sprintf(
'Invalid source path (%s) or languageKey (%s)', $sourcePath, $languageKey), 1309245002);