Custom translation servers

With the usage of XLIFF and the freely available Pootle translation server, companies and individuals may easily set up a custom translation server for their extensions.

The event ModifyLanguagePackRemoteBaseUrlEvent can be caught to change the translation server URL. The first step is to register your custom listener for the event. Such code would be placed in an extension's Services.yml file:

  # Place here the default dependency injection configuration

      - name: event.listener
        identifier: 'my-extension/custom-mirror'

Read how to configure dependency injection in extensions.

The class (listener) that receives the event might look something like this:



namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;

final class CustomMirror
    private const EXTENSION_KEY = 'my_extension';
    private const MIRROR_URL = '';

    public function __invoke(ModifyLanguagePackRemoteBaseUrlEvent $event): void
        if ($event->getPackageKey() === self::EXTENSION_KEY) {
            $event->setBaseUrl(new Uri(self::MIRROR_URL));

In the above example, the URL is changed only for a given extension, but of course it could be changed on a more general basis.

On the custom translation server side, the structure needs to be:
`-- <first-letter-of-extension-key>
    `-- <second-letter-of-extension-key>
        `-- <extension-key>-l10n
            |-- <extension-key>
            |-- <extension-key>
            `-- <extension-key>

hence in our example:
`-- m
    `-- y
        `-- my_extension-l10n