ModifyLanguagePacksEvent
Deprecated since version 14.2
The event
Modify
have been moved to
typo3/cms-core
. Therefore the namespace
changed from TYPO3CMSInstall
to
\TYPO3\.
There is a class alias that will be removed with TYPO3 v15.0.
See Deprecation: #109027 - Move language:update command and events to EXT:core.
The PSR-14 event
\TYPO3\
allows to ignore extensions or individual language packs for extensions when
downloading language packs.
The options of the
language: command can be used to further
restrict the download (ignore additional extensions or download only certain
languages), but not to ignore decisions made by the event.
Example
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Install\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent;
#[AsEventListener(
identifier: 'my-extension/modify-language-packs',
)]
final readonly class MyEventListener
{
public function __invoke(ModifyLanguagePacksEvent $event): void
{
$extensions = $event->getExtensions();
foreach ($extensions as $key => $extension) {
// Do not download language packs from Core extensions
if ($extension['type'] === 'typo3-cms-framework') {
$event->removeExtension($key);
}
}
// Remove German language pack from EXT:styleguide
$event->removeIsoFromExtension('de', 'styleguide');
}
}