Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Introduce event to prevent downloading of language packs
With the newly introduced event, it is possible to ignore extensions or individual language packs for extensions when downloading the language packs. Resolves: #98394 Releases: main Change-Id: I5ff3b3bcdc4de41338d6925412c81ccb1df022e3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77485 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Stefan Bürk <stefan@buerk.tech>
- Loading branch information
1 parent
b933845
commit 4ca1de8
Showing
7 changed files
with
192 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ngelog/12.2/Feature-98394-IntroduceEventToPreventDownloadingOfLanguagePacks.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
.. _feature-98394-1674070213: | ||
|
||
========================================================================== | ||
Feature: #98394 - Introduce event to prevent downloading of language packs | ||
========================================================================== | ||
|
||
See :issue:`98394` | ||
|
||
Description | ||
=========== | ||
|
||
.. code-block:: yaml | ||
:caption: Configuration/Services.yaml | ||
services: | ||
KA\Myext\EventListener\ModifyLanguagePacks: | ||
tags: | ||
- name: event.listener | ||
identifier: 'modifyLanguagePacks' | ||
event: TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent | ||
method: 'modifyLanguagePacks' | ||
.. code-block:: php | ||
:caption: Classes/EventListener/ModifyLanguagePacks.php | ||
<?php | ||
namespace KA\Myext\EventListener; | ||
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent; | ||
class ModifyLanguagePacks | ||
{ | ||
public function modifyLanguagePacks(ModifyLanguagePacksEvent $event): void | ||
{ | ||
$extensions = $event->getExtensions(); | ||
foreach ($extensions as $key => $extension){ | ||
if($extension['type'] === 'typo3-cms-framework'){ | ||
$event->removeExtension($key); | ||
} | ||
} | ||
$event->removeIsoFromExtension('de', 'styleguide'); | ||
} | ||
} | ||
Impact | ||
====== | ||
|
||
With the newly introduced event, it is possible to ignore extensions or | ||
individual language packs for extensions when downloading the language packs. | ||
It is still the case that only language packs for extensions and languages | ||
available in the system can be downloaded. The options of the language:update | ||
command can be used to further restrict the download (ignore additional | ||
extensions or download only specific languages), but not to ignore decisions | ||
made by the event. | ||
|
||
.. index:: ext:install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
typo3/sysext/install/Classes/Service/Event/ModifyLanguagePacksEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Install\Service\Event; | ||
|
||
/** | ||
* Event to modify the language pack array | ||
*/ | ||
final class ModifyLanguagePacksEvent | ||
{ | ||
public function __construct(private array $extensions) | ||
{ | ||
} | ||
|
||
public function getExtensions(): array | ||
{ | ||
return $this->extensions; | ||
} | ||
|
||
public function removeExtension(string $extension): void | ||
{ | ||
unset($this->extensions[$extension]); | ||
} | ||
|
||
public function removeIsoFromExtension(string $iso, string $extension): void | ||
{ | ||
unset($this->extensions[$extension]['packs'][$iso]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.