Issue Bug Under Review

#111391Translation Domain Mapping and LLL:EXT references behave different on non-existing XLIFF keys

S P 11/10/26, 07:29 updated 11/10/26, 17:44

Description

If you reference a non-existing XLIFF key with LLL:EXT: the label will just be the empy string. However if you refence this existing key with the new Translation Domain Mapping then the label will be the literal reference string, like my_ext.messages:some.non_existing.label.

I discovered this on TCA field descriptions (but I assume this will be a general bug, since the labels work consistently everywhere through the same API).

According to the changelog both should behave the same, so technically this is a bug, becasue they do not behave the same.

Personal side note: I’m actually not sure yet, whether I like the new buggy behaviour even better (to spot missing labels more easily). ;) However if you have a general auto-applied scheme in a custom ext and relied on missing label -> empty string this can be super tedious.

Reviews 1

History 12

  1. Benni Mack commented <span data-processor="relativetime" data-value="2026-11-10T17:33:46+00:00" > 11/10/26, 17:33 </span>

    Thanks for the report! I looked into it, and the difference doesn’t come from the translation domain syntax. It comes from the optional LLL: prefix. LanguageService::sL(), which TCA labels and descriptions go through, behaves like this for a missing label:

    • LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:missing → ''
    • LLL:my_ext.messages:missing → ''
    • my_ext.messages:missing → my_ext.messages:missing
    • EXT:my_ext/Resources/Private/Language/locallang.xlf:missing → EXT:my_ext/Resources/Private/Language/locallang.xlf:missing

    Without the prefix, sL() can’t tell a label reference apart from a plain string that contains a colon (e.g. Note: read this). So if nothing is found, it returns the input unchanged. With LLL: it knows it’s a reference and returns an empty string, as before.

    So if you want “missing label → empty string”, write the domain reference with the prefix: 'description' => 'LLL:my_ext.messages:some.label'.

    Other APIs don’t depend on the prefix: label()/@translate()@ return null or the given default, <f:translate> returns its default, and TypoScript LLL: always returns an empty string.

    You’re right that the changelog doesn’t mention any of this, and “can be used interchangeably” is misleading here. I’ve opened a docs PR for it: https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/7478

    We could change sL() to decide based on whether the domain actually resolves, rather than on the prefix. That would only happen in v15, because on 14 LTS it would change existing output (and, as you noted, the visible key has its upsides). Opinions welcome.