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.

There is an event that can be caught to change the translation server URL to use. The first step is to register one’s listener for the event. Such code would be placed in an extension’s services.yml file:

      - name: event.listener
        identifier: 'ext-extensions/customMirror'
        method: 'postProcessMirrorUrl'
        event: \TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent

The class (listener) which receives the event (EXT:extensions/Classes/Listeners/CustomMirror.php) could look something like:

namespace Company\Extensions\Listener;
use \TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;
class CustomMirror {
   static protected $extensionKey = 'myext';

   public function postProcessMirrorUrl(ModifyLanguagePackRemoteBaseUrlEvent $event): void
      if ($event->getPackageKey() === self::$extensionKey) {
         $mirrorUrl = 'http://mycompany.tld/typo3-packages/';

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>
         `-- <extension-key>-l10n.xml

hence in our example:

`-- m
   `-- y
      `-- myext-l10n
         `-- myext-l10n.xml

And the myext-l10n.xml file contains something like:

<?xml version="1.0" standalone="yes" ?>
      <date>2013-07-26 14:23:06</date>
      <languagepack language="de">
      <languagepack language="fr">
      <languagepack language="it">