Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
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.
file:
services:
# Place here the default dependency injection configuration
MyVendor\MyExtension\EventListener\CustomMirror:
tags:
- 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:
<?php
declare(strict_types=1);
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 = 'https://example.org/typo3-packages/';
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:
https://example.org/typo3-packages/
`-- <first-letter-of-extension-key>
`-- <second-letter-of-extension-key>
`-- <extension-key>-l10n
|-- <extension-key>-l10n-de.zip
|-- <extension-key>-l10n-fr.zip
`-- <extension-key>-l10n-it.zip
hence in our example:
https://example.org/typo3-packages/
`-- m
`-- y
`-- my_extension-l10n
|-- my_extension-l10n-de.zip
|-- my_extension-l10n-fr.zip
`-- my_extension-l10n-it.zip