Label references / LLL strings
Strings prefixed with LLL:
are found in many places in TYPO3. They are "label
references" - references to labels that will be translated into the current language.
The general format of a label reference is:
LLL:EXT:<extension_key>/<path_to_xliff_file>:<identifier>
For example:
LLL:EXT:my_extension/Resources/Private/Language/locallang_db.xlf:mytable.myfield
If a different language is set or a language file is overridden, the path is automatically adjusted.
Table of contents
File paths in label references
Localized labels are stored in files with
XLIFF format.
Most XLIFF files are located in
EXT:
and its subfolders.
In some cases the locations are different:
- Site sets – Localization files for site set definitions are stored in
the site set folder, for example:
EXT:
my_ extension/ Configuration/ Sets/ My Set/ labels. xlf - Content blocks – Third-party extensions can define their own structure.
For example, the extension
friendsoftypo3/content-blocks
stores labels alongside the
content block definitions:
EXT:
my_ extension/ Configuration/ Sets/ My Set/ labels. xlf
Resolving localized labels
In many cases, such as the label of a TCA field, you can use a label reference, and TYPO3 will resolve it.
If label references are not resolved, you can do it manually:
Fluid: Using the f:translate ViewHelper
Use the f:translate ViewHelper to insert translated strings in Fluid templates.
<f:translate key="LLL:EXT:my_extension/Resources/Private/Language/yourFile.xlf:yourKey" />
<!-- or as inline Fluid: -->
{f:translate(key: 'LLL:EXT:my_extension/Resources/Private/Language/yourFile.xlf:yourKey')}
See also: The translation ViewHelper f:translate
TypoScript: Using the getText property
The getText property LLL can be used to fetch translations from a language file and render them in the current language.
lib.blogListTitle = TEXT
lib.blogListTitle {
data = LLL : EXT:blog_example/Resources/Private/Language/locallang.xlf:blog.list
}
Make sure to leave spaces around the colon following LLL
(as required by
general getText syntax).
See also: Output localized strings with TypoScript
PHP: Using the LanguageService
In PHP localized labels can be retrieved via the
Language
, which can be created
using the
Language
.
The recommended way to determine the correct
Language
instance depends on context:
- Frontend: use the language in the current request object
(
\Server
) or the default site language.Request Interface - Backend: use the language of the logged-in backend user.
- CLI: determine the language programmatically depending on your use case (for example, when sending emails via scheduler tasks).
For more details, see Localization in PHP.
Once you have the correct LanguageService instance, you can resolve labels as follows:
use TYPO3\CMS\Core\Localization\LanguageService;
private function translateSomething(
LanguageService $languageService,
string $labelReference
): string {
return $languageService->sL($labelReference);
}