diff --git a/Classes/Hooks/TranslateHook.php b/Classes/Hooks/TranslateHook.php index 84db8b58..78a6338a 100644 --- a/Classes/Hooks/TranslateHook.php +++ b/Classes/Hooks/TranslateHook.php @@ -141,11 +141,7 @@ public function processTranslateTo_copyAction(&$content, $languageRecord, $dataH } else { $currentRecord = BackendUtility::getRecord($tablename, (int) $currectRecordId); - $selectedTCAvalues = $this->getTemplateValues($currentRecord, $tablename, $field, $content); - - if (!empty($selectedTCAvalues)) { - $response = $this->deeplService->translateRequest($selectedTCAvalues, $targetLanguage['language_isocode'], $sourceLanguage['language_isocode']); - } + $response = $this->deeplService->translateRequest($content, $targetLanguage['language_isocode'], $sourceLanguage['language_isocode']); } if (!empty($response) && isset($response->translations)) { foreach ($response->translations as $translation) { @@ -164,11 +160,7 @@ public function processTranslateTo_copyAction(&$content, $languageRecord, $dataH } else { $currentRecord = BackendUtility::getRecord($tablename, (int) $currectRecordId); - $selectedTCAvalues = $this->getTemplateValues($currentRecord, $tablename, $field, $content); - - if (!empty($selectedTCAvalues)) { - $response = $this->googleService->translate($sourceLanguage['language_isocode'], $targetLanguage['language_isocode'], $selectedTCAvalues); - } + $response = $this->googleService->translate($content, $targetLanguage['language_isocode'], $content); } if (!empty($response)) { if ($this->isHtml($response)) { @@ -236,30 +228,4 @@ public function stripSpecificTags($tags, $content) return $content; } - /** - * Returns default content of records according to the typoscript setting from typoscript - * @param array $recorddata - * @param string $table - * @param string $field - * @return void - */ - public function getTemplateValues($recorddata, $table, $field, $content) - { - $rootLineUtility = GeneralUtility::makeInstance('TYPO3\CMS\Core\Utility\RootlineUtility',$recorddata['pid']); - $rootLine = $rootLineUtility->get(); - $TSObj = GeneralUtility::makeInstance('TYPO3\CMS\Core\TypoScript\TemplateService'); - $TSObj->tt_track = 0; - $TSObj->init(); - $TSObj->runThroughTemplates($rootLine); - $TSObj->generateConfig(); - if ($table != '') { - $fieldlist = $TSObj->setup['plugin.'][$table . '.']['translatableTCAvalues']; - if ($fieldlist != null && strpos($fieldlist, $field) !== false) { - $value = $this->deeplSettingsRepository->getRecordField($table, $field, $recorddata); - } else { - return $content; - } - } - } - } diff --git a/Classes/Override/LocalizationController.php b/Classes/Override/LocalizationController.php index 3df438c3..9236f963 100644 --- a/Classes/Override/LocalizationController.php +++ b/Classes/Override/LocalizationController.php @@ -266,14 +266,12 @@ protected function process($params): void /** * check deepl Settings (url,apikey). * @param ServerRequestInterface $request - * @param ResponseInterface $response * @return array */ - public function checkdeeplSettings(ServerRequestInterface $request, ResponseInterface $response) + public function checkdeeplSettings(ServerRequestInterface $request) { $this->deeplService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('WebVision\\WvDeepltranslate\\Service\\DeeplService'); $result = []; - $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['wv_deepltranslate']); if ($this->deeplService->apiKey != null && $this->deeplService->apiUrl != null) { $result['status'] = 'true'; } else { diff --git a/Classes/Service/DeeplService.php b/Classes/Service/DeeplService.php index 55ab26e5..a601f78c 100644 --- a/Classes/Service/DeeplService.php +++ b/Classes/Service/DeeplService.php @@ -33,6 +33,7 @@ use WebVision\WvDeepltranslate\Domain\Repository\DeeplSettingsRepository; use TYPO3\CMS\Core\Http\RequestFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; class DeeplService { @@ -73,7 +74,7 @@ class DeeplService */ public function __construct() { - $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['wv_deepltranslate']); + $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('wv_deepltranslate'); $this->deeplSettingsRepository = GeneralUtility::makeInstance(DeeplSettingsRepository::class); $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class); diff --git a/Classes/Service/GoogleTranslateService.php b/Classes/Service/GoogleTranslateService.php index a61aecd1..1790a7da 100644 --- a/Classes/Service/GoogleTranslateService.php +++ b/Classes/Service/GoogleTranslateService.php @@ -32,6 +32,7 @@ use GuzzleHttp\Exception\ClientException; use TYPO3\CMS\Core\Http\RequestFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; class GoogleTranslateService { @@ -57,7 +58,7 @@ class GoogleTranslateService public function __construct() { $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class); - $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['wv_deepltranslate']); + $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('wv_deepltranslate'); $this->apiUrl = $extConf['googleapiUrl']; $this->apiKey = $extConf['googleapiKey']; } diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php new file mode 100644 index 00000000..705ad324 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_template.php @@ -0,0 +1,19 @@ + - image/svg+xml - - - - - - - background - - - - Layer 1 - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/Resources/Public/Icons/settings.svg b/Resources/Public/Icons/settings.svg index 8bb78d0d..43e54946 100644 --- a/Resources/Public/Icons/settings.svg +++ b/Resources/Public/Icons/settings.svg @@ -1,6 +1,6 @@ - background + settings diff --git a/ext_emconf.php b/ext_emconf.php index e9687848..4003a4f7 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -21,10 +21,10 @@ 'uploadfolder' => '0', 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '1.1.1', + 'version' => '1.1.2', 'constraints' => [ 'depends' => [ - 'typo3' => '9.5.1-9.5.99', + 'typo3' => '9.5.1-10.4.99', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_icon.svg b/ext_icon.svg index 49716120..fbce7688 100644 --- a/ext_icon.svg +++ b/ext_icon.svg @@ -1 +1,70 @@ -icon \ No newline at end of file + + + + diff --git a/ext_tables.php b/ext_tables.php index 3028762b..a414b958 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,12 +1,8 @@ 'EXT:wv_deepltranslate/Resources/Public/Icons/deepl.svg', 'access' => 'user,group', - 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xlf', + 'labels' => 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang.xlf', ) ); @@ -47,9 +43,9 @@ function ($extKey) { 'Settings' => 'index,saveSettings', ), array( - 'icon' => 'EXT:wv_deepltranslate/Resources/Public/Icons/settings.svg', + 'icon' => 'EXT:install/Resources/Public/Icons/module-install-settings.svg', 'access' => 'user,group', - 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_module_settings.xlf', + 'labels' => 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_module_settings.xlf', ) );