Skip to content

Commit a84c4aa

Browse files
author
Carsten Walther
committed
fix typo3 v9 compatibility; localisation initialize
1 parent 2abd356 commit a84c4aa

File tree

4 files changed

+35
-90
lines changed

4 files changed

+35
-90
lines changed

Classes/Configuration/Configuration.php

+9-22
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use TYPO3\CMS\Core\Localization\LanguageService;
66
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
7+
use TYPO3\CMS\Core\Utility\GeneralUtility;
78
use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
89

910
/**
@@ -33,28 +34,14 @@ class Configuration
3334
*
3435
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
3536
*/
36-
public function __construct(LanguageService $languageService = NULL)
37-
{
38-
self::$languageService = $languageService;
39-
if (self::$languageService) {
40-
self::$languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
41-
}
42-
}
43-
44-
/**
45-
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
46-
*
47-
* @return void
48-
*/
49-
public function injectLanguageService(LanguageService $languageService) : void
50-
{
51-
if (!self::$languageService) {
52-
self::$languageService = $languageService;
53-
if (self::$languageService) {
54-
self::$languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
55-
}
56-
}
57-
}
37+
public function __construct(LanguageService $languageService = NULL)
38+
{
39+
self::$languageService = $languageService;
40+
if (!self::$languageService) {
41+
self::$languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
42+
}
43+
self::$languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
44+
}
5845

5946
/**
6047
* set

Classes/Controller/Html2pdfController.php

+8-24
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,15 @@ class Html2pdfController
2727

2828
/**
2929
* Html2pdfController constructor.
30-
*
31-
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
3230
*/
33-
public function __construct(LanguageService $languageService = NULL)
34-
{
35-
$this->languageService = $languageService;
36-
if ($this->languageService) {
37-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
38-
}
39-
}
40-
41-
/**
42-
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
43-
*
44-
* @return void
45-
*/
46-
public function injectLanguageService(LanguageService $languageService) : void
47-
{
48-
if (!$this->languageService) {
49-
$this->languageService = $languageService;
50-
if ($this->languageService) {
51-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
52-
}
53-
}
54-
}
31+
public function __construct(LanguageService $languageService = NULL)
32+
{
33+
$this->languageService = $languageService;
34+
if (!$this->languageService) {
35+
$this->languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
36+
}
37+
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
38+
}
5539

5640
/**
5741
* hookOutput

Classes/Converter/Converter.php

+10-22
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Psr\Log\LoggerAwareTrait;
99
use RuntimeException;
1010
use TYPO3\CMS\Core\Localization\LanguageService;
11+
use TYPO3\CMS\Core\Utility\GeneralUtility;
12+
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
1113
use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
1214
use Walther\Html2pdf\Configuration\Configuration;
1315

@@ -30,28 +32,14 @@ class Converter implements LoggerAwareInterface
3032
*
3133
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
3234
*/
33-
public function __construct(LanguageService $languageService = NULL)
34-
{
35-
$this->languageService = $languageService;
36-
if ($this->languageService) {
37-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
38-
}
39-
}
40-
41-
/**
42-
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
43-
*
44-
* @return void
45-
*/
46-
public function injectLanguageService(LanguageService $languageService) : void
47-
{
48-
if (!$this->languageService) {
49-
$this->languageService = $languageService;
50-
if ($this->languageService) {
51-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
52-
}
53-
}
54-
}
35+
public function __construct(LanguageService $languageService = NULL)
36+
{
37+
$this->languageService = $languageService;
38+
if (!$this->languageService) {
39+
$this->languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
40+
}
41+
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
42+
}
5543

5644
/**
5745
* convert

Classes/Report/ExtensionStatus.php

+8-22
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,14 @@ class ExtensionStatus implements StatusProviderInterface
3131
*
3232
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
3333
*/
34-
public function __construct(LanguageService $languageService = NULL)
35-
{
36-
$this->languageService = $languageService;
37-
if ($this->languageService) {
38-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
39-
}
40-
}
41-
42-
/**
43-
* @param \TYPO3\CMS\Core\Localization\LanguageService $languageService
44-
*
45-
* @return void
46-
*/
47-
public function injectLanguageService(LanguageService $languageService) : void
48-
{
49-
if (!$this->languageService) {
50-
$this->languageService = $languageService;
51-
if ($this->languageService) {
52-
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
53-
}
54-
}
55-
}
34+
public function __construct(LanguageService $languageService = NULL)
35+
{
36+
$this->languageService = $languageService;
37+
if (!$this->languageService) {
38+
$this->languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
39+
}
40+
$this->languageService->includeLLFile('EXT:html2pdf/Resources/Private/Language/locallang.xlf');
41+
}
5642

5743
/**
5844
* getStatus

0 commit comments

Comments
 (0)