ModifyLanguagePacksEvent

New in version 12.2.

The PSR-14 event \TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent allows to ignore extensions or individual language packs for extensions when downloading language packs.

The options of the language:update 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

Registration of the event:

EXT:my_extension/Configuration/Services.yaml
services:
  MyVendor\MyExtension\EventListener\ModifyLanguagePacks:
    tags:
      - name: event.listener
        identifier: 'modifyLanguagePacks'

Implementation of the event listener:

EXT:my_extension/Classes/EventListener/ModifyLanguagePacks.php
namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent;

final class ModifyLanguagePacks
{
    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');
    }
}

API

class TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent

Event to modify the language pack array

getExtensions()
Return type

array

removeExtension(string $extension)
Parameters
  • $extension (string) -- the extension

removeIsoFromExtension(string $iso, string $extension)
Parameters
  • $iso (string) -- the iso

  • $extension (string) -- the extension