---
title: "Localization"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:localization@11.5"
source: "ExtensionArchitecture/Extbase/Reference/Localization.rst"
rendered: "2026-10-21T15:30:00+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v11 has reached end-of-life as of October 31th 2024 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Localization {#localization}

Multilingual websites are widespread nowadays, which means that the
web-available texts have to be localized. Extbase provides the helper class
`\TYPO3\CMS\Extbase\Utility\LocalizationUtility` for the translation of the labels. Besides,
there is the Fluid ViewHelper `<f:translate>`, with the help of whom you can use that
functionality in templates.

The localization class has only one public static method called `translate`, which
does all the translation. The method can be called like this:

**EXT:my_extension/Classes/Controller/SomeController.php**

```php
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

$someString = LocalizationUtility::translate($key, $extensionName, $arguments);
```

-   **`$key`**

    The identifier to be translated. If the format *LLL:path:key* is given, then this
    identifier is used, and the parameter `$extensionName` is ignored. Otherwise, the
    file `Resources/Private/Language/locallang.xlf` from the given extension is loaded,
    and the resulting text for the given key in the current language returned.

-   **`$extensionName`**

    The extension name. It can be fetched from the request.

-   **`$arguments`**

    It allows you to specify an array of arguments. In the `LocalizationUtility`, these arguments will be passed to the function `vsprintf`. So you can insert dynamic values in every translation. You can find the possible wildcard specifiers under [https://www.php.net/manual/function.sprintf.php#refsect1-function.sprintf-parameters](https://www.php.net/manual/function.sprintf.php#refsect1-function.sprintf-parameters).

    *Example language file with inserted wildcards*

    **EXT:my_extension/Resources/Private/Language/locallang.xlf**

    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <xliff version="1.0" xmlns="urn:oasis:names:tc:xliff:document:1.1">
       <file source-language="en" datatype="plaintext" original="messages" date="..." product-name="...">
          <header/>
          <body>
             <trans-unit id="count_posts">
                <source>You have %d posts with %d comments written.</source>
             </trans-unit>
             <trans-unit id="greeting">
                <source>Hello %s!</source>
             </trans-unit>
          </body>
       </file>
    </xliff>
    ```

    *Called translations with arguments to fill data in wildcards*

    **EXT:my_extension/Classes/Controller/SomeController.php**

    ```php
    use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

    $someString = LocalizationUtility::translate('count_posts', 'BlogExample', [$countPosts, $countComments])

    $anotherString = LocalizationUtility::translate('greeting', 'BlogExample', [$userName])
    ```
