News

Two speech bubbles surrounded by circular synchronization arrows

Keeping TYPO3 FAL References in Sync Across Languages

A PSR-14 event listener lets you synchronize file selection, order and image crops across languages in TYPO3. Here’s how I keep the relevant fields on each file reference editable in translation.

If you run a multilingual TYPO3 website where each language version is a direct translation of the original, as I do on my own site, there is usually little reason to manage images and other media separately for every language.

If I replace an image, reorder a gallery or adjust a crop, I want to make the change once. Alternative text and captions can vary by language and by how the image is used.

Language synchronization at field level

The Table Configuration Array (TCA) controls how individual fields are localized. Two properties are particularly relevant for language synchronization.

  • With config.behaviour.allowLanguageSynchronization set to true, editors can give a field its own value or keep it in sync with the record in the default or source language.
  • When l10n_mode is set to exclude, the field cannot be edited individually in localized records. TYPO3’s DataHandler keeps its value in sync with the record in the default language. For a relation field, that means synchronizing which records are attached.

With the File Abstraction Layer (FAL), it helps to distinguish the relation to the file from the properties of each file reference. A website can use the same file several times, with a different crop in each place.

TCA fields of type file, such as Media [pages.media] or Images [tt_content.image], define the relation. The file references themselves and their properties are stored in the sys_file_reference table.

Keeping the file selection in sync while translating reference fields

My first thought was to set l10n_mode = exclude at both levels. That would enforce synchronization with the default language for the file selection and order, as well as for the Image manipulation (crop) and Autoplay (autoplay) fields on each file reference.

With l10n_mode = exclude, TYPO3 hides the entire file field in localized records, so editors lose access to the translatable fields of each file reference. On my site, for example, the whole Resources tab disappears from the page properties. You can show the file field again with l10n_display = defaultAsReadonly. The fields of the related records remain read-only.

I still want to edit Alternative Text (alternative), Title (title), Description (Caption) (description) and Link (link) in each language. I therefore enable allowLanguageSynchronization on the file field and make sure its Translation behavior is set to Value of default language in the backend. TYPO3 then keeps the file selection and order in sync, and editors can still edit the translatable fields of each file reference in the same form.

In TYPO3 v14.3, this is currently the only way to meet both requirements using the available Core configuration.

One event listener for the whole project

I want to define the localization behavior for my site in one place. An event listener lets me apply the same settings to every file field in a translatable table.

With the PSR-14 event AfterTcaCompilationEvent, TYPO3 lets you adjust the fully compiled TCA before it is cached. At that point, the TCA definitions and overrides from all installed extensions are already in place.

Classes/EventListener/SynchronizeFileReferences.php

<?php

declare(strict_types=1);

namespace ErHaWeb\Sitepackage\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent;

#[AsEventListener(
    identifier: 'sitepackage/synchronize-file-references',
)]
final class SynchronizeFileReferences
{
    public function __invoke(AfterTcaCompilationEvent $event): void
    {
        $tca = $event->getTca();

        foreach ($tca as $tableName => $tableConfiguration) {
            if (empty($tableConfiguration['ctrl']['languageField'])) {
                continue;
            }

            foreach ($tableConfiguration['columns'] ?? [] as $fieldName => $column) {
                if (($column['config']['type'] ?? null) !== 'file') {
                    continue;
                }

                $tca[$tableName]['columns'][$fieldName]['config']['behaviour']['allowLanguageSynchronization'] = true;

                unset(
                    $tca[$tableName]['columns'][$fieldName]['l10n_mode'],
                    $tca[$tableName]['columns'][$fieldName]['l10n_display']
                );
            }
        }

        foreach (['crop', 'autoplay'] as $fieldName) {
            $tca['sys_file_reference']['columns'][$fieldName]['l10n_mode'] = 'exclude';
            $tca['sys_file_reference']['columns'][$fieldName]['l10n_display'] = 'defaultAsReadonly';

            unset(
                $tca['sys_file_reference']['columns'][$fieldName]['config']['behaviour']['allowLanguageSynchronization']
            );
        }

        $event->setTca($tca);
    }
}

What does the event listener do?

We start by going through the TCA for every table with a language field defined in ctrl.languageField. That limits the change to tables that support localization. In those tables, we look for every field with config.type = file.

We enable config.behaviour.allowLanguageSynchronization for these file fields. We remove any existing l10n_mode and l10n_display settings so editors can access the file field and edit its references in the translation.

For crop and autoplay in sys_file_reference, we set l10n_mode to exclude and remove any existing allowLanguageSynchronization setting. TYPO3’s DataHandler then keeps the crop variants and autoplay setting in sync for linked references. With l10n_display = defaultAsReadonly, TYPO3 shows these two fields as read-only in the translation, using the values from the default language. That lets me see those settings while I translate.

Adding the listener to your site package

To use the event listener in your own site package, adapt the namespace to match your extension. If you use the usual automatic service registration with autoconfigure: true, the #[AsEventListener] PHP attribute registers the listener.

Clear the TYPO3 system cache to rebuild the TCA.

If no translation behavior has been saved for a file field, TYPO3 uses Value of default language when you enable allowLanguageSynchronization.

In an existing project, open the original record in the default language and save it to sync file selection and order in synchronized fields. If TYPO3 saves the original file references at the same time, it also updates the crops of the references linked to them. On my site, saving the page in the Layout module was enough.

What happens when editors select their own files?

Editors can still decide whether to synchronize the file field. If they set its Translation behavior to Custom value, they can choose and order files independently for that language.

Existing localization links between file references stay in place. As long as a reference is linked to its original through l10n_parent, TYPO3 continues to synchronize its crop and autoplay setting. Adding an image directly in the translation creates a new file reference without a localization link. That also applies if you select the same file that is already used in the default language.

If you later switch back to Value of default language, TYPO3 may remove file references that were added only in the translation.

For my site, I’d like to hide the Custom value option. TYPO3 Core currently includes this option whenever allowLanguageSynchronization is enabled. I rely on that setting to keep the translatable fields of each file reference editable.

Looking ahead

The TYPO3 issue tracker has covered these aspects of file reference synchronization for some time. Forge #88024 discusses why file selection and image cropping are synchronized separately. Forge #88766 shows how difficult it can be for editors to predict what happens when they change the translation behavior.

We revisited this use case at the Translation Handling Initiative meeting on December 4, 2026. On a relation field, both l10n_mode = exclude and allowLanguageSynchronization with Value of default language can keep the same items in the same order. For editors, what matters is whether they can still edit the fields of the related records in the translation.

What we’re missing in Core is a way to enforce synchronization of a relation and decide separately which fields of the related records stay translatable. This would also help with inline relations (IRRE). In an accordion, for example, I could keep the same items in the same order and still translate their headings and text.

We discussed two possible approaches. enforceLanguageSynchronization could be a counterpart to allowLanguageSynchronization for cases where synchronization is required. Another idea was to add a value such as excludeParent to l10n_mode. How best to configure relation synchronization and editing of related records in the TCA is still open.

Conclusion

What I already like about this approach is that I can configure localization for my entire website in one central place. If I add more fields of type file through new Content Blocks, extensions or TCA changes, the same configuration applies to them automatically.

When I edit my website, I can focus on the content that actually varies from one language to another.