Bug #88517
closed
Localization in Middleware
Added by Roman Büchler over 5 years ago.
Updated about 5 years ago.
Description
A Middleware has been configured to be processed after 'typo3/cms-frontend/prepare-tsfe-rendering'.
When fetching a translation in the process method with
$GLOBALS['LANG']->sL('LLL:EXT:myext/Resources/Private/Language/locallang.xlf:item');
the English version is returned even though the default language is German. When using a TYPO3\CMS\Fluid\View\StandaloneView the labels from the template get translated correctly.
- Project changed from 9 to TYPO3 Core
- Category deleted (
Development)
- TYPO3 Version set to 9
- Moved to correct Project
- Guessed Version 9
- Category set to Localization
- Status changed from New to Needs Feedback
Hey,
```
$GLOBALS['LANG']
```
is configured to use the Backend User's language, and only works with the Backend User to be available (= when a BE user is logged in). I suggest you build a custom LanguageService initialization. In addition, the issue 89575 now allows to do this step earlier in TSFE (after TSFE initialization middleware) in v10. Maybe that helps a bit!
Benni Mack wrote:
Hey,
```
$GLOBALS['LANG']
```
is configured to use the Backend User's language, and only works with the Backend User to be available (= when a BE user is logged in). I suggest you build a custom LanguageService initialization. In addition, the issue 89575 now allows to do this step earlier in TSFE (after TSFE initialization middleware) in v10. Maybe that helps a bit!
Thank you very much for the feedback.
@Roman Büchler thank you for your reply; may I ask you if there is still something that should be done here? Thank you!
Riccardo De Contardi wrote:
@Roman Büchler thank you for your reply; may I ask you if there is still something that should be done here? Thank you!
No, the ticket could be closed from my side.
- Status changed from Needs Feedback to Closed
Closed in agreement with the reporter.
Also available in: Atom
PDF