---
title: "XLIFF API: Access language labels"
manual: "TYPO3 Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:xliff-api@13.4"
source: "ApiOverview/Localization/XliffApi.rst"
rendered: "2026-10-05T17:28:20+00:00"
---

# XLIFF API: Access language labels {#xliff-api}

**Table of contents**

-   [PHP: LanguageService and LocalizationUtility](https://docs.typo3.org/permalink/t3coreapi:php-languageservice-and-localizationutility@13.4)
-   [Fluid: The translate ViewHelper](https://docs.typo3.org/permalink/t3coreapi:fluid-the-translate-viewhelper@13.4)

## PHP: LanguageService and LocalizationUtility {#xliff-api-php}

In PHP, a typical call in the Backend to fetch a string in the language selected by a user
looks like this:

```php
$this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
```

`getLanguageService()` is a call to a helper method that accesses `$GLOBALS['LANG']`. In the Backend, the bootstrap
parks an initialized instance of `\TYPO3\CMS\Core\Localization\LanguageService` at this place. This may change in the
future, but for now the LanguageService can be reliably fetched from this global.

> [!NOTE]
> The `->sL()` API does *not* apply a `htmlspecialchars()` call to the translated string. If the string
> is returned in a web context, it *must* be added manually.

If additional placeholders are used in a translation source, they must be injected, a call then typically looks like this:

```php
// Text string in .xlf file has a placeholder:
// <trans-unit id="message.description.fileHasBrokenReferences">
//     <source>The file has %1s broken reference(s) but it will be deleted regardless.</source>
// </trans-unit>
sprintf($this->getLanguageService()->sL(
    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:message.description.fileHasBrokenReferences'),
    count($brokenReferences)
);
```

Various classes are involved in the localization process, with
`\TYPO3\CMS\Core\Localization\LanguageService` providing the actual
methods to retrieve a localized label. `sL()` loads a language file if needed first, and then
returns a label from it (using a string with the `LLL:EXT:...` syntax as argument).

Extbase class `\TYPO3\CMS\Extbase\Utility\LocalizationUtility` is essentially a
convenience wrapper around the `\TYPO3\CMS\Core\Localization\LanguageService` class,
whose `translate()` method also takes an array as argument and runs PHP's
`vsprintf()` on the localized string. However, in the future it is expected this Extbase
specific class will melt down and somehow merged into the Core API classes to get rid of this
duplication.

## Fluid: The translate ViewHelper {#xliff-api-fluid}

In Fluid, a typical call to fetch a string in the language selected by a user looks like this:

```html
<f:translate key="key1" extensionName="SomeExtensionName" />
// or inline notation
{f:translate(key: 'someKey', extensionName: 'SomeExtensionName')}
```

If the correct context is set, the current extension name and language is
provided by the request. Otherwise it must be provided.

> [!NOTE]
> **See also**
>
> ViewHelper Reference: [Translate ViewHelper \<f:translate>](https://docs.typo3.org/other/typo3/view-helper-reference/13.4/en-us/Global/Translate.html#typo3-fluid-translate)
