CSH changes, adding all the images in system extensions!
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / lang.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. TYPO3 is free software;
9 * You can redistribute it and/or modify it under the terms of the
10 * TYPO3 License as published from the www.typo3.com website.
11 *
12 * This script is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * This copyright notice MUST APPEAR in all copies of this script
17 ***************************************************************/
18 /**
19 * Contains the TYPO3 Backend Language class
20 *
21 * $Id$
22 * Revised for TYPO3 3.6.0
23 *
24 * @author Kasper Skaarhoj <kasper@typo3.com>
25 */
26 /**
27 * [CLASS/FUNCTION INDEX of SCRIPT]
28 *
29 *
30 *
31 * 79: class language
32 * 127: function init($lang,$altPath='')
33 * 172: function addModuleLabels($arr,$prefix)
34 * 198: function hscAndCharConv($lStr,$hsc)
35 * 213: function makeEntities($str)
36 * 230: function JScharCode($str)
37 * 249: function getLL($index,$hsc=0)
38 * 266: function getLLL($index,$LOCAL_LANG,$hsc=0)
39 * 286: function sL($input,$hsc=0)
40 * 330: function loadSingleTableDescription($table)
41 * 382: function includeLLFile($fileRef,$setGlobal=1,$mergeLocalOntoDefault=0)
42 * 427: function readLLfile($fileRef)
43 * 441: function localizedFileRef($fileRef)
44 *
45 * TOTAL FUNCTIONS: 12
46 * (This index is automatically created/updated by the extension "extdeveval")
47 *
48 */
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 /**
66 * Contains the TYPO3 Backend Language class
67 *
68 * For detailed information about how localization is handled,
69 * please refer to the 'Inside TYPO3' document which descibes this.
70 *
71 * This class is normally instantiated as the global variable $LANG in typo3/template.php
72 * It's only available in the backend and under certain circumstances in the frontend
73 *
74 * @author Kasper Skaarhoj <kasper@typo3.com>
75 * @package TYPO3
76 * @subpackage core
77 * @see typo3/template.php, template
78 */
79 class language {
80 var $lang='default'; // This is set to the language that is currently running for the user
81 var $langSplit='default'; // Values like the labels in the tables.php-document are split by '|'. This values defines which language is represented by which position in the resulting array after splitting a value. (NOTICE: Obsolete concept!)
82
83 // Default charset in backend
84 var $charSet = 'iso-8859-1';
85
86 // Array with alternative charsets for other languages. (Moved to t3lib_cs, Set from csConvObj!)
87 var $charSetArray = array();
88
89 // This is the url to the TYPO3 manual
90 var $typo3_help_url= 'http://www.typo3.com/man_uk/';
91 // Array with alternative URLs based on language.
92 var $helpUrlArray = array(
93 'dk' => 'http://www.typo3.com/man_dk/',
94 );
95
96
97 var $moduleLabels = Array(); // Can contain labels and image references from the backend modules. Relies on t3lib_loadmodules to initialize modules after a global instance of $LANG has been created.
98
99 // Internal
100 var $langSplitIndex=0; // Points to the position of the current language key as found in constant TYPO3_languages
101 var $LL_files_cache=array(); // Internal cache for read LL-files
102 var $LL_labels_cache=array(); // Internal cache for ll-labels (filled as labels are requested)
103
104 // Internal charset conversion:
105 var $origCharSet=''; // If set, then it means that the this->charSet is set to a forced, common value for the WHOLE backend regardless of user language. And THIS variable will contain the original charset for the language labels. With ->csConvObj we must then convert the original charset to the charset used in the backend from now on.
106 var $csConvObj; // An instance of the "t3lib_cs" class. May be used by any application.
107
108
109
110
111
112
113
114
115 /**
116 * Initializes the backend language.
117 * This is for example done in typo3/template.php with lines like these:
118 *
119 * require (PATH_typo3.'sysext/lang/lang.php');
120 * $LANG = t3lib_div::makeInstance('language');
121 * $LANG->init($BE_USER->uc['lang']);
122 *
123 * @param string The language key (two character string from backend users profile)
124 * @param string IGNORE. Not used.
125 * @return void
126 */
127 function init($lang,$altPath='') {
128
129 // Initialize the conversion object:
130 $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
131 $this->charSetArray = $this->csConvObj->charSetArray;
132
133 // Internally setting the list of TYPO3 backend languages.
134 $this->langSplit=TYPO3_languages;
135
136 // Finding the requested language in this list based on the $lang key being inputted to this function.
137 $ls = explode('|',$this->langSplit);
138 while(list($i,$v)=each($ls)) {
139 if ($v==$lang) { // Language is found. Configure it:
140 $this->langSplitIndex=$i; // The index of the language as found in the TYPO3_languages list
141 $this->lang = $lang; // The current language key
142 if ($this->helpUrlArray[$this->lang]) $this->typo3_help_url=$this->helpUrlArray[$this->lang]; // The help URL if different from the default.
143 if ($this->charSetArray[$this->lang]) $this->charSet=$this->charSetArray[$this->lang]; // The charset if different from the default.
144 }
145 }
146
147 // If a forced charset is used and different from the charset otherwise used:
148 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']!=$this->charSet) {
149 // Set the forced charset:
150 $this->origCharSet = $this->charSet;
151 $this->charSet = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
152
153 if ($this->charSet!='utf-8' && !$this->csConvObj->initCharset($this->charSet)) {
154 t3lib_BEfunc::typo3PrintError ('The forced character set "'.$this->charSet.'" was not found in t3lib/csconvtbl/','Forced charset not found');
155 exit;
156 }
157 if ($this->origCharSet!='utf-8' && !$this->csConvObj->initCharset($this->origCharSet)) {
158 t3lib_BEfunc::typo3PrintError ('The original character set "'.$this->origCharSet.'" was not found in t3lib/csconvtbl/','Forced charset not found');
159 exit;
160 }
161 }
162 }
163
164 /**
165 * Adds labels and image references from the backend modules to the internal moduleLabels array
166 *
167 * @param array Array with references to module labels, keys: ['labels']['tablabel'], ['labels']['tabdescr'], ['tabs']['tab']
168 * @param string Module name prefix
169 * @return void
170 * @see t3lib_loadModules
171 */
172 function addModuleLabels($arr,$prefix) {
173 if (is_array($arr)) {
174 reset($arr);
175 while(list($k,$larr)=each($arr)) {
176 if (!isset($this->moduleLabels[$k])) {
177 $this->moduleLabels[$k]=array();
178 }
179 if (is_array($larr)) {
180 reset($larr);
181 while(list($l,$v)=each($larr)) {
182 $this->moduleLabels[$k][$prefix.$l]=$v;
183 }
184 }
185 }
186 }
187 }
188
189 /**
190 * Will htmlspecialchar() the input string and before that any charset conversion will also have taken place if needed (see init())
191 * Used to pipe language labels through just before they are returned.
192 *
193 * @param string The string to process
194 * @param boolean If set, then the string is htmlspecialchars()'ed
195 * @return string The processed string
196 * @see init()
197 */
198 function hscAndCharConv($lStr,$hsc) {
199 $lStr = $hsc ? htmlspecialchars($lStr) : $lStr;
200 if ($this->origCharSet) {
201 $lStr = $this->csConvObj->conv($lStr,$this->origCharSet,$this->charSet,1);
202 }
203 return $lStr;
204 }
205
206 /**
207 * Will convert the input strings special chars (all above 127) to entities. The string is expected to be encoded in the charset, $this->charSet
208 * This function is used to create strings that can be used in the Click Menu (Context Sensitive Menus). The reason is that the values that are dynamically written into the <div> layer is decoded as iso-8859-1 no matter what charset is used in the document otherwise (only MSIE, Mozilla is OK). So by converting we by-pass this problem.
209 *
210 * @param string Input string
211 * @return string Output string
212 */
213 function makeEntities($str) {
214 // Convert string to UTF-8:
215 if ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet);
216
217 // Convert string back again, but using the full entity conversion:
218 $str = $this->csConvObj->utf8_to_entities($str);
219 return $str;
220 }
221
222 /**
223 * Converts the input string to a JavaScript function returning the same string, but charset-safe.
224 * Used for confirm and alert boxes where we must make sure that any string content does not break the script AND want to make sure the charset is preserved.
225 * Originally I used the JS function unescape() in combination with PHP function rawurlencode() in order to pass strings in a safe way. This could still be done for iso-8859-1 charsets but now I have applied the same method here for all charsets.
226 *
227 * @param string Input string, encoded with $this->charSet
228 * @return string Output string, a JavaScript function: "String.fromCharCode(......)"
229 */
230 function JScharCode($str) {
231
232 // Convert string to UTF-8:
233 if ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet);
234
235 // Convert the UTF-8 string into a array of char numbers:
236 $nArr = $this->csConvObj->utf8_to_numberarray($str);
237
238 return 'String.fromCharCode('.implode(',',$nArr).')';
239 }
240
241 /**
242 * Returns the label with key $index form the globally loaded $LOCAL_LANG array.
243 * Mostly used from modules with only one LOCAL_LANG file loaded into the global space.
244 *
245 * @param string Label key
246 * @param boolean If set, the return value is htmlspecialchar'ed
247 * @return string
248 */
249 function getLL($index,$hsc=0) {
250 // Get Local Language
251 if (strcmp($GLOBALS['LOCAL_LANG'][$this->lang][$index],'')) {
252 return $this->hscAndCharConv($GLOBALS['LOCAL_LANG'][$this->lang][$index], $hsc); // Returns local label if not blank.
253 } else {
254 return $this->hscAndCharConv($GLOBALS['LOCAL_LANG']['default'][$index], $hsc); // Returns default label
255 }
256 }
257
258 /**
259 * Works like ->getLL() but takes the $LOCAL_LANG array used as the second argument instead of using the global array.
260 *
261 * @param string Label key
262 * @param array $LOCAL_LANG array to get label key from
263 * @param boolean If set, the return value is htmlspecialchar'ed
264 * @return string
265 */
266 function getLLL($index,$LOCAL_LANG,$hsc=0) {
267 // Get Local Language
268 if (strcmp($LOCAL_LANG[$this->lang][$index],'')) {
269 return $this->hscAndCharConv($LOCAL_LANG[$this->lang][$index], $hsc); // Returns local label if not blank.
270 } else {
271 return $this->hscAndCharConv($LOCAL_LANG['default'][$index], $hsc); // Returns default label
272 }
273 }
274
275 /**
276 * splitLabel function
277 * Historically labels were exploded by '|' and each part would correspond to the translation of the language found at the same 'index' in the TYPO3_languages constant.
278 * Today all translations are based on $LOCAL_LANG variables. 'language-splitted' labels can therefore refer to a local-lang file + index instead!
279 * It's highly recommended to use the 'local_lang' method (and thereby it's highly depreciated to use 'language-splitted' label strings)
280 * Refer to 'Inside TYPO3' for more details
281 *
282 * @param string Label key/reference
283 * @param boolean If set, the return value is htmlspecialchar'ed
284 * @return string
285 */
286 function sL($input,$hsc=0) {
287 if (strcmp(substr($input,0,4),'LLL:')) { // Using obsolete 'language-splitted' labels:
288 $t = explode('|',$input);
289 $out = $t[$this->langSplitIndex] ? $t[$this->langSplitIndex] : $t[0];
290 return $this->hscAndCharConv($out, $hsc);
291 } else { // LOCAL_LANG:
292 if (!isset($this->LL_labels_cache[$this->lang][$input])) { // If cached label
293 $restStr = trim(substr($input,4));
294 $extPrfx='';
295 if (!strcmp(substr($restStr,0,4),'EXT:')) { // ll-file refered to is found in an extension.
296 $restStr = trim(substr($restStr,4));
297 $extPrfx='EXT:';
298 }
299 $parts = explode(':',$restStr);
300 $parts[0]=$extPrfx.$parts[0];
301 if (!isset($this->LL_files_cache[$parts[0]])) { // Getting data if not cached
302 $this->LL_files_cache[$parts[0]] = $this->readLLfile($parts[0]);
303
304 // If the current language is found in another file, load that as well:
305 $lFileRef = $this->localizedFileRef($parts[0]);
306 if ($lFileRef && is_string($this->LL_files_cache[$parts[0]][$this->lang]) && $this->LL_files_cache[$parts[0]][$this->lang]=='EXT') {
307 $tempLL = $this->readLLfile($lFileRef);
308 $this->LL_files_cache[$parts[0]][$this->lang] = $tempLL[$this->lang];
309 }
310
311 // Overriding file?
312 if (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]])) {
313 $ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]]);
314 $this->LL_files_cache[$parts[0]] = t3lib_div::array_merge_recursive_overrule($this->LL_files_cache[$parts[0]],$ORarray);
315 }
316 }
317 $this->LL_labels_cache[$this->lang][$input] = $this->getLLL($parts[1],$this->LL_files_cache[$parts[0]]);
318 }
319 return $hsc ? t3lib_div::deHSCentities(htmlspecialchars($this->LL_labels_cache[$this->lang][$input])) : $this->LL_labels_cache[$this->lang][$input]; // For the cached output charset conversion has already happend! So perform HSC right here.
320 }
321 }
322
323 /**
324 * Loading $TCA_DESCR[$table]['columns'] with content from locallang files as defined in $TCA_DESCR[$table]['refs']
325 * $TCA_DESCR is a global var
326 *
327 * @param string Table name found as key in global array $TCA_DESCR
328 * @return void
329 */
330 function loadSingleTableDescription($table) {
331 global $TCA_DESCR;
332
333 if (is_array($TCA_DESCR[$table])
334 && !isset($TCA_DESCR[$table]['columns'])
335 && is_array($TCA_DESCR[$table]['refs'])) { // First the 'table' cannot already be loaded in [columns] and secondly there must be a references to locallang files available in [refs]
336
337 // Init $TCA_DESCR for $table-key
338 $TCA_DESCR[$table]['columns']=array();
339
340 // Get local-lang for each file in $TCA_DESCR[$table]['refs'] as they are ordered.
341 foreach ($TCA_DESCR[$table]['refs'] as $llfile) {
342 $LOCAL_LANG = $this->includeLLFile($llfile,0,1);
343
344 // Traverse all keys
345 if (is_array($LOCAL_LANG['default'])) {
346 foreach($LOCAL_LANG['default'] as $lkey => $lVal) {
347
348 // exploding by '.':
349 // 0 => fieldname,
350 // 1 => type from (alttitle,description,details,syntax,image_descr,image,seeAlso),
351 // 2 => special instruction, see switch construct
352 $kParts = explode('.',$lkey);
353
354 // Detecting 'hidden' labels, converting to normal fieldname
355 if ($kParts[0]=='_') $kParts[0]='';
356 if (substr($kParts[0],0,1)=='_') { $kParts[0] = substr($kParts[0],1); }
357
358 // Add label:
359 switch((string)$kParts[2]) {
360 case '+': // adding
361 $TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]].= chr(10).$lVal;
362 break;
363 default: // Substituting:
364 $TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]] = $lVal;
365 break;
366 }
367 }
368 }
369 }
370 }
371 }
372
373 /**
374 * Includes locallang file (and possibly additional localized version if configured for)
375 * Read language labels will be merged with $LOCAL_LANG (if $setGlobal=1).
376 *
377 * @param string $fileRef is a file-reference (see t3lib_div::getFileAbsFileName)
378 * @param boolean Setting in global variable $LOCAL_LANG (or returning the variable)
379 * @param boolean If $mergeLocalOntoDefault is set the local part of the $LOCAL_LANG array is merged onto the default part (if the local part exists) and the local part is unset.
380 * @return mixed If $setGlobal is true the LL-files will set the $LOCAL_LANG in the global scope. Otherwise the $LOCAL_LANG array is returned from function
381 */
382 function includeLLFile($fileRef,$setGlobal=1,$mergeLocalOntoDefault=0) {
383 // Configure for global flag:
384 if ($setGlobal) {
385 global $LOCAL_LANG;
386 }
387
388 // Get default file:
389 $llang = $this->readLLfile($fileRef);
390
391 if (count($llang)) {
392
393 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG,$llang);
394
395 // Localized addition?
396 $lFileRef = $this->localizedFileRef($fileRef);
397 if ($lFileRef && (string)$LOCAL_LANG[$this->lang]=='EXT') {
398 $llang = $this->readLLfile($lFileRef);
399 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG,$llang);
400 }
401
402 // Overriding file?
403 if (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef])) {
404 $ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef]);
405 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG,$ORarray);
406 }
407
408 // Merge local onto default:
409 if ($mergeLocalOntoDefault && strcmp($this->lang,'default') && is_array($LOCAL_LANG[$this->lang]) && is_array($LOCAL_LANG['default'])) {
410 $LOCAL_LANG['default'] = array_merge($LOCAL_LANG['default'],$LOCAL_LANG[$this->lang]); // array_merge can be used so far the keys are not numeric - which we assume they are not...
411 unset($LOCAL_LANG[$this->lang]);
412 }
413 }
414
415 // Return value if not global is set.
416 if (!$setGlobal) {
417 return $LOCAL_LANG;
418 }
419 }
420
421 /**
422 * Includes a locallang file and returns the $LOCAL_LANG array found inside.
423 *
424 * @param string Input is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array.
425 * @return array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array
426 */
427 function readLLfile($fileRef) {
428 $file = t3lib_div::getFileAbsFileName($fileRef);
429 if ($file) {
430 $baseFile = ereg_replace('\.(php|xml)$', '', $file);
431
432 if (@is_file($baseFile.'.xml')) {
433 $LOCAL_LANG = $this->readLLXMLfile($baseFile.'.xml', $this->lang);
434 } elseif (@is_file($baseFile.'.php')) {
435 include($baseFile.'.php');
436 } else die('Filereference, "'.$file.'", not found!');
437 }
438 return is_array($LOCAL_LANG)?$LOCAL_LANG:array();
439 }
440
441 /**
442 * Includes a locallang-xml file and returns the $LOCAL_LANG array
443 *
444 * @param string Absolute reference to locallang-XML file
445 * @param string TYPO3 language key, eg. "dk" or "de" or "default"
446 * @return array LOCAL_LANG array in return.
447 */
448 function readLLXMLfile($fileRef,$langKey) {
449
450 if (@is_file($fileRef) && $langKey) {
451
452 // Set charset:
453 $origCharset = $this->csConvObj->parse_charset($this->csConvObj->charSetArray[$langKey] ? $this->csConvObj->charSetArray[$langKey] : 'iso-8859-1');
454
455 // Cache file name:
456 $hashSource = substr($fileRef,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($fileRef));
457 $cacheFileName = PATH_site.'typo3temp/llxml/'.
458 #str_replace('_','',ereg_replace('^.*\/','',dirname($fileRef))).
459 #'_'.basename($fileRef).
460 substr(basename($fileRef),10,15).
461 '_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
462
463 // Check if cache file exists...
464 if (!@is_file($cacheFileName)) { // ... if it doesn't, create content and write it:
465
466 // Read XML, parse it.
467 $xmlString = t3lib_div::getUrl($fileRef);
468 $xmlContent = t3lib_div::xml2array($xmlString);
469
470 // Set default LOCAL_LANG array content:
471 $LOCAL_LANG = array();
472 $LOCAL_LANG['default'] = $xmlContent['data']['default'];
473
474 // Specific language, convert from utf-8 to backend language charset:
475 // NOTICE: Converting from utf-8 back to "native" language may be a temporary solution until we can totally discard "locallang.php" files altogether (and use utf-8 for everything). But doing this conversion is the quickest way to migrate now and the source is in utf-8 anyway which is the main point.
476 if ($langKey!='default') {
477 $LOCAL_LANG[$langKey] = $xmlContent['data'][$langKey];
478
479 // Checking if charset should be converted.
480 if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
481 foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
482 $LOCAL_LANG[$langKey][$labelKey] = $this->csConvObj->utf8_decode($labelValue,$origCharset);
483 }
484 }
485 }
486
487 // Cache the content now:
488 $serContent = array('origFile'=>$hashSource, 'LOCAL_LANG'=>$LOCAL_LANG);
489 $res = t3lib_div::writeFileToTypo3tempDir($cacheFileName, serialize($serContent));
490 if ($res) die('ERROR: '.$res);
491 } else {
492 // Get content from cache:
493 $serContent = unserialize(t3lib_div::getUrl($cacheFileName));
494 $LOCAL_LANG = $serContent['LOCAL_LANG'];
495 }
496
497 // Checking for EXTERNAL file for non-default language:
498 if ($langKey!='default' && is_string($LOCAL_LANG[$langKey]) && strlen($LOCAL_LANG[$langKey])) {
499
500 // Look for localized file:
501 $localized_file = t3lib_div::getFileAbsFileName($LOCAL_LANG[$langKey]);
502 if ($localized_file && @is_file($localized_file)) {
503
504 // Cache file name:
505 $hashSource = substr($localized_file,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($localized_file));
506 $cacheFileName = PATH_site.'typo3temp/llxml/ext_'.
507 substr(basename($localized_file),10,15).
508 '_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
509
510 // Check if cache file exists...
511 if (!@is_file($cacheFileName)) { // ... if it doesn't, create content and write it:
512
513 // Read and parse XML content:
514 $local_xmlString = t3lib_div::getUrl($localized_file);
515 $local_xmlContent = t3lib_div::xml2array($local_xmlString);
516 $LOCAL_LANG[$langKey] = is_array($local_xmlContent['data'][$langKey]) ? $local_xmlContent['data'][$langKey] : array();
517
518 // Checking if charset should be converted.
519 if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
520 foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
521 $LOCAL_LANG[$langKey][$labelKey] = $this->csConvObj->utf8_decode($labelValue,$origCharset);
522 }
523 }
524
525 // Cache the content now:
526 $serContent = array('extlang'=>$langKey, 'origFile'=>$LOCAL_LANG[$langKey], 'EXT_DATA'=>$LOCAL_LANG[$langKey]);
527 $res = t3lib_div::writeFileToTypo3tempDir($cacheFileName, serialize($serContent));
528 if ($res) die('ERROR: '.$res);
529 } else {
530 // Get content from cache:
531 $serContent = unserialize(t3lib_div::getUrl($cacheFileName));
532 $LOCAL_LANG[$langKey] = $serContent['EXT_DATA'];
533 }
534 }
535 }
536
537 return $LOCAL_LANG;
538 }
539 }
540
541 /**
542 * Returns localized fileRef (.[langkey].php)
543 *
544 * @param string Filename/path of a 'locallang.php' file
545 * @return string Input filename with a '.[lang-key].php' ending added if $this->lang is not 'default'
546 */
547 function localizedFileRef($fileRef) {
548 if ($this->lang!='default' && substr($fileRef,-4)=='.php') {
549 return substr($fileRef,0,-4).'.'.$this->lang.'.php';
550 }
551 }
552 }
553
554 // Include extension to the template class?
555 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/lang.php']) {
556 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/lang.php']);
557 }
558 ?>