Language

The language frontend request attribute provides information about the current language of the webpage via the \TYPO3\CMS\Core\Site\Entity\SiteLanguage object.

Example:

$language = $request->getAttribute('language');
$locale = $language->getLocale();

API

class TYPO3\CMS\Core\Site\Entity\SiteLanguage

Entity representing a site_language configuration of a site object.

toArray()

Returns the SiteLanguage in an array representation for e.g. the usage in TypoScript.

Return type

array

getLanguageId()
Return type

int

getLocale()
Return type

TYPO3\CMS\Core\Localization\Locale

getBase()
Return type

Psr\Http\Message\UriInterface

getTitle()
Return type

string

getNavigationTitle()
Return type

string

getWebsiteTitle()
Return type

string

getFlagIdentifier()
Return type

string

getTypo3Language()

Returns the XLF label language key, returns "default" when it is "en".

"default" is currently still needed for TypoScript label overloading. For locales like "en-US", this method returns "en_US" which can then be used for XLF file prefixes properly.

Return type

string

getTwoLetterIsoCode()

Deprecated: not needed anymore, use $this->getLocale()->getLanguageCode() instead.

Returns the ISO-639-1 language ISO code

Return type

string

getHreflang(bool $isInternalCall = false)

Deprecated: not needed anymore, use $siteLanguage->getLocale()->getName() instead.

Returns the RFC 1766 / 3066 language tag

Parameters
  • $isInternalCall (bool) -- the isInternalCall, default: false

Return type

string

getDirection()

Deprecated: in favor of $this->locale->isRightToLeftLanguageDirection()

Returns the language direction

Return type

string

enabled()

Returns true if the language is available in frontend usage

Return type

bool

isEnabled()

Helper so fluid can work with this as well.

Return type

bool

getFallbackType()
Return type

string

getFallbackLanguageIds()
Return type

array