exotec
exotec

Reputation: 459

How do I get the sys_language_uid with extbase

In TYPO3 9.5 is only $GLOBALS['TSFE']->sys_language_isocode available. How do I get the numeric sys_languagae_uid in my controller?

Upvotes: 0

Views: 1621

Answers (1)

Michael
Michael

Reputation: 2331

You can use the new Context singleton for this:

$context = GeneralUtility::makeInstance(Context::class);
return (int)$context->getPropertyFromAspect('language', 'id');

This will return the numerical "sys_language_uid". When you look into the docblock of the Context class (see public/typo3/sysext/core/Classes/Context/Context.php, there is also a list of possible aspects you may use. There also is a documentation available.

Upvotes: 3

Related Questions