#111391Translation Domain Mapping and LLL:EXT references behave different on non-existing XLIFF keys
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
-
Gerrit Code Review pushed patch set 1 for main to change 97521 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-10T17:44:24+00:00" > 11/10/26, 17:44 </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:missingEXT:my_ext/Resources/Private/Language/locallang.xlf:missing→EXT:my_ext/Resources/Private/Language/locallang.xlf:missingWithout 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. WithLLL: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()@ returnnullor the given default,<f:translate>returns itsdefault, and TypoScriptLLL: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.