---
title: "LanguageService"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:languageservice-api@11.5"
source: "ApiOverview/Localization/LocalizationApi/LanguageService.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).

# LanguageService {#languageservice-api}

This class is used to translate strings in plain PHP. For examples
see [Localization in PHP](https://docs.typo3.org/permalink/t3coreapi:extension-localization-php@11.5). A `LanguageService` **should not**
be created directly, therefore its constructor is internal. Create a
`LanguageService` with the [LanguageServiceFactory](https://docs.typo3.org/permalink/t3coreapi:languageservicefactory-api@11.5).

In the backend context a `LanguageService` is stored in the global
variable `$GLOBALS['LANG']`.

-   **class LanguageService**

    -   *Fully qualified name:* `\TYPO3\CMS\Core\Localization\LanguageService`

    Main API to fetch labels from XLF (label files) based on the current system
    language of TYPO3. It is able to resolve references to files + their pointers to the
    proper language. If you see something about "LLL", this class does the trick for you. It
    is not related for language handling of content, but rather of labels for plugins.

    Usually this is injected into $GLOBALS\['LANG'\] when in backend or CLI context, and
    populated by the current backend user. Don't rely on $GLOBAL\['LANG'\] in frontend, as it is only
    available in certain circumstances!
    In Frontend, this is also used to translate "labels", see TypoScriptFrontendController->sL()
    for that.

    As TYPO3 internally does not match the proper ISO locale standard, the "locale" here
    is actually a list of supported language keys, (see Locales class), whereas "english"
    has the language key "default".

    -   **lang**

        This is set to the language that is currently running for the user

    -   **debugKey**

        If TRUE, will show the key/location of labels in the backend.

    -   **getLL(string $index)**

        Returns the label with key $index from the globally loaded $LOCAL_LANG array.

        Mostly used from modules with only one LOCAL_LANG file loaded into the global space.

        -   *param string $index:* Label key

    -   **sL(string $input)**

        splitLabel function

        All translations are based on $LOCAL_LANG variables.
        'language-splitted' labels can therefore refer to a local-lang file + index.
        Refer to 'Inside TYPO3' for more details

        -   *param string $input:* Label key/reference
        -   *returntype:* string

    -   **includeLLFile(string $fileRef)**

        Includes locallang file (and possibly additional localized version if configured for)
        Read language labels will be merged with $LOCAL_LANG (if $setGlobal = TRUE).

        -   *param string $fileRef:* $fileRef is a file-reference

    -   **create(string $locale)**

        Factory method to create a language service object.

        -   *param string $locale:* the locale (= the TYPO3-internal locale given)
        -   *returntype:* self

    -   **createFromUserPreferences(TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\AbstractUserAuthentication $user)**

        -   *param TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\AbstractUserAuthentication $user:* the user
        -   *returntype:* self

    -   **createFromSiteLanguage(TYPO3\\\\CMS\\\\Core\\\\Site\\\\Entity\\\\SiteLanguage $language)**

        -   *param TYPO3\\\\CMS\\\\Core\\\\Site\\\\Entity\\\\SiteLanguage $language:* the language
        -   *returntype:* self
