Reputation: 1
I use TYPO3 8.7.3 and my own extension.
So far, I was able to use the $GLOBALS['TSFE']->config['config']['language']
variable to switch in extbase to another language.
This is actually not possible.
Is there a new way to switch between languages in the action of a controller?
Important for me to create Mails and PDF throw:
\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate
BR
Daniel
Upvotes: 0
Views: 533
Reputation: 3488
In your action you can check for sys_language_uid like this:
if ($GLOBALS['TSFE']->sys_language_uid == 0 ) {
// Your English text
} else if ($GLOBALS['TSFE']->sys_language_uid == 1) {
// Your German text
} else {
// Your English text
}
... when language is set via typoscript:
[globalVar = GP:L = 0]
config {
...
sys_language_uid = 0
sys_language_isocode = en
}
[global]
[globalVar = GP:L = 1]
config {
...
sys_language_uid = 1
sys_language_isocode = de
}
[global]
Upvotes: 1