@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | class LanguageFileGenerator implements SingletonInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - protected $template = '<?xml version="1.0" encoding="UTF-8"?> |
|
| 21 | + protected $template = '<?xml version="1.0" encoding="UTF-8"?> |
|
| 22 | 22 | <xliff version="1.0"> |
| 23 | 23 | <file source-language="en" datatype="plaintext" original="messages" date="" product-name="local lang module"> |
| 24 | 24 | <header/> |
@@ -36,53 +36,53 @@ discard block |
||
| 36 | 36 | </file> |
| 37 | 37 | </xliff>'; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $dataType |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function generate($dataType) |
|
| 44 | - { |
|
| 45 | - $label = $dataType; |
|
| 46 | - if (!empty($GLOBALS['TCA'][$dataType]['ctrl']['title'])) { |
|
| 47 | - $label = $this->getLanguageService()->sL($GLOBALS['TCA'][$dataType]['ctrl']['title']); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $dataType |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function generate($dataType) |
|
| 44 | + { |
|
| 45 | + $label = $dataType; |
|
| 46 | + if (!empty($GLOBALS['TCA'][$dataType]['ctrl']['title'])) { |
|
| 47 | + $label = $this->getLanguageService()->sL($GLOBALS['TCA'][$dataType]['ctrl']['title']); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - // Generate language file. |
|
| 51 | - $languageFile = $this->getLanguageFile($dataType); |
|
| 52 | - $content = str_replace('{module_name}', $label, $this->template); |
|
| 53 | - GeneralUtility::writeFileToTypo3tempDir($languageFile, $content); |
|
| 50 | + // Generate language file. |
|
| 51 | + $languageFile = $this->getLanguageFile($dataType); |
|
| 52 | + $content = str_replace('{module_name}', $label, $this->template); |
|
| 53 | + GeneralUtility::writeFileToTypo3tempDir($languageFile, $content); |
|
| 54 | 54 | |
| 55 | - return 'LLL:' . $languageFile; |
|
| 56 | - } |
|
| 55 | + return 'LLL:' . $languageFile; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @param $dataType |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - protected function getLanguageFile($dataType) |
|
| 63 | - { |
|
| 64 | - return $this->getLanguageDirectory() . '/' . $dataType . '.xlf'; |
|
| 65 | - } |
|
| 58 | + /** |
|
| 59 | + * @param $dataType |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + protected function getLanguageFile($dataType) |
|
| 63 | + { |
|
| 64 | + return $this->getLanguageDirectory() . '/' . $dataType . '.xlf'; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @return string |
|
| 69 | - */ |
|
| 70 | - protected function getLanguageDirectory() |
|
| 71 | - { |
|
| 72 | - // Create language file dynamically |
|
| 73 | - $languageDirectory = PATH_site . 'typo3temp/vidi'; |
|
| 74 | - if (!is_dir($languageDirectory)) { |
|
| 75 | - GeneralUtility::mkdir($languageDirectory); |
|
| 76 | - } |
|
| 77 | - return $languageDirectory; |
|
| 78 | - } |
|
| 67 | + /** |
|
| 68 | + * @return string |
|
| 69 | + */ |
|
| 70 | + protected function getLanguageDirectory() |
|
| 71 | + { |
|
| 72 | + // Create language file dynamically |
|
| 73 | + $languageDirectory = PATH_site . 'typo3temp/vidi'; |
|
| 74 | + if (!is_dir($languageDirectory)) { |
|
| 75 | + GeneralUtility::mkdir($languageDirectory); |
|
| 76 | + } |
|
| 77 | + return $languageDirectory; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @return \TYPO3\CMS\Lang\LanguageService |
|
| 82 | - */ |
|
| 83 | - protected function getLanguageService() |
|
| 84 | - { |
|
| 85 | - return GeneralUtility::makeInstance(LanguageService::class, $GLOBALS['BE_USER']->uc['lang']); |
|
| 86 | - } |
|
| 80 | + /** |
|
| 81 | + * @return \TYPO3\CMS\Lang\LanguageService |
|
| 82 | + */ |
|
| 83 | + protected function getLanguageService() |
|
| 84 | + { |
|
| 85 | + return GeneralUtility::makeInstance(LanguageService::class, $GLOBALS['BE_USER']->uc['lang']); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $content = str_replace('{module_name}', $label, $this->template); |
| 53 | 53 | GeneralUtility::writeFileToTypo3tempDir($languageFile, $content); |
| 54 | 54 | |
| 55 | - return 'LLL:' . $languageFile; |
|
| 55 | + return 'LLL:'.$languageFile; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function getLanguageFile($dataType) |
| 63 | 63 | { |
| 64 | - return $this->getLanguageDirectory() . '/' . $dataType . '.xlf'; |
|
| 64 | + return $this->getLanguageDirectory().'/'.$dataType.'.xlf'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | protected function getLanguageDirectory() |
| 71 | 71 | { |
| 72 | 72 | // Create language file dynamically |
| 73 | - $languageDirectory = PATH_site . 'typo3temp/vidi'; |
|
| 73 | + $languageDirectory = PATH_site.'typo3temp/vidi'; |
|
| 74 | 74 | if (!is_dir($languageDirectory)) { |
| 75 | 75 | GeneralUtility::mkdir($languageDirectory); |
| 76 | 76 | } |