378821086d72eed3cd8c97aa5514609a663680bb
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Localization.php
1 <?php
2 namespace TYPO3\CMS\Form;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Class to handle localizations
19 */
20 class Localization {
21
22 /**
23 * File reference to the local language file
24 *
25 * @var string
26 */
27 protected $localLanguageFile;
28
29 /**
30 * Constructor
31 *
32 * @param string $localLanguageFile File reference to the local language file
33 */
34 public function __construct($localLanguageFile = 'LLL:EXT:form/Resources/Private/Language/locallang_controller.xlf') {
35 $this->localLanguageFile = (string)$localLanguageFile;
36 }
37
38 /**
39 * Get a label from local language
40 *
41 * @param string $labelKey Key to look for
42 * @return string
43 */
44 public function getLocalLanguageLabel($labelKey) {
45 if (TYPO3_MODE === 'FE') {
46 $output = $GLOBALS['TSFE']->sL($this->localLanguageFile . ':' . $labelKey);
47 } else {
48 $output = $GLOBALS['LANG']->sL($this->localLanguageFile . ':' . $labelKey);
49 }
50 return $output;
51 }
52
53 }