forked from web-vision/wv_deepltranslate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_localconf.php
101 lines (82 loc) · 6.24 KB
/
ext_localconf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
defined('TYPO3') or die();
(static function (): void {
$typo3version = new \TYPO3\CMS\Core\Information\Typo3Version();
if ($typo3version->getMajorVersion() < 12) {
// @todo Remove this after TYPO3 v12 is minimal supported version.
// Since TYPO3 v12 `Configuration/page.tsconfig` is auto loaded and contains a include to that file, therefore
// it needs to be only loaded manually for TYPO3 v11 as global PageTSConfig.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:wv_deepltranslate/Configuration/TsConfig/Page/pagetsconfig.tsconfig">'
);
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['wvDeepltranslate_updateGlossary']
= \WebVision\WvDeepltranslate\Upgrades\GlossaryUpgradeWizard::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['wvDeepltranslate_formalityUpgrade']
= \WebVision\WvDeepltranslate\Upgrades\FormalityUpgradeWizard::class;
//allowLanguageSynchronizationHook manipulates l10n_state
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][]
= \WebVision\WvDeepltranslate\Hooks\AllowLanguageSynchronizationHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][]
= \WebVision\WvDeepltranslate\Hooks\Glossary\UpdatedGlossaryEntryTermHook::class;
//hook for translate content
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass']['deepl']
= \WebVision\WvDeepltranslate\Hooks\TranslateHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['deepl']
= \WebVision\WvDeepltranslate\Hooks\TranslateHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][\WebVision\WvDeepltranslate\Hooks\UsageProcessAfterFinishHook::class]
= \WebVision\WvDeepltranslate\Hooks\UsageProcessAfterFinishHook::class;
//hook to checkModifyAccessList for editors
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList']['deepl']
= \WebVision\WvDeepltranslate\Hooks\TCEmainHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']['deepl-1675946132'] =
\WebVision\WvDeepltranslate\Hooks\DeeplPreviewFlagGeneratePageHook::class . '->renderDeeplPreviewFlag';
//xclass localizationcontroller for localizeRecords() and process() action
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Controller\Page\LocalizationController::class] = [
'className' => \WebVision\WvDeepltranslate\Override\LocalizationController::class,
];
if ($typo3version->getMajorVersion() >= 12) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Controller\RecordListController::class] = [
'className' => \WebVision\WvDeepltranslate\Override\Core12\DeeplRecordListController::class,
];
//xclass databaserecordlist for rendering custom checkboxes to toggle deepl selection in recordlist
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\RecordList\DatabaseRecordList::class] = [
'className' => \WebVision\WvDeepltranslate\Override\Core12\DatabaseRecordList::class,
];
} else {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Recordlist\Controller\RecordListController::class] = [
'className' => \WebVision\WvDeepltranslate\Override\Core11\DeeplRecordListController::class,
];
//xclass databaserecordlist for rendering custom checkboxes to toggle deepl selection in recordlist
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class] = [
'className' => \WebVision\WvDeepltranslate\Override\Core11\DatabaseRecordList::class,
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Controller\PageLayoutController::class] = [
'className' => \WebVision\WvDeepltranslate\Override\Core11\PageLayoutController::class,
];
// button hook changed to event, registration here only needed for v11
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend\Template\Components\ButtonBar']['getButtonsHook']['wv_deepltranslate'] =
\WebVision\WvDeepltranslate\Hooks\ButtonBarHook::class . '->getButtons';
}
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('container')) {
//xclass CommandMapPostProcessingHook for translating contents within containers
if (class_exists(\B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook::class)) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook::class] = [
'className' => \WebVision\WvDeepltranslate\Override\CommandMapPostProcessingHook::class,
];
}
}
// We need to provide the global backend javascript module instead of calling page-renderer here directly - which
// cannot be done and checking the context (FE/BE) directly. Instantiating PageRenderer here directly would be
// emitted an exception as the cache configuration manager cannot be retrieved in this early stage.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][1684661135]
= \WebVision\WvDeepltranslate\Hooks\PageRendererHook::class . '->renderPreProcess';
//add caching for DeepL API-supported Languages
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['wvdeepltranslate']
??= [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['wvdeepltranslate']['backend']
??= \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class;
$accessRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\WebVision\WvDeepltranslate\Access\AccessRegistry::class);
$accessRegistry->addAccess((new \WebVision\WvDeepltranslate\Access\AllowedTranslateAccess()));
$accessRegistry->addAccess((new \WebVision\WvDeepltranslate\Access\AllowedGlossarySyncAccess()));
})();