Bug #88517

Localization in Middleware

Added by Roman Büchler 8 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2019-06-07
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

History

#1 Updated by Bastian Bringenberg 8 months ago

  • Project changed from forge.typo3.org to TYPO3 Core
  • Category deleted (Development)
  • TYPO3 Version set to 9

- Moved to correct Project
- Guessed Version 9

#2 Updated by Riccardo De Contardi 5 months ago

  • Category set to Localization

#3 Updated by Benni Mack 3 months ago

  • 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!

#4 Updated by Roman Büchler 3 months ago

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.

#5 Updated by Riccardo De Contardi 2 months ago

@Roman Büchler thank you for your reply; may I ask you if there is still something that should be done here? Thank you!

#6 Updated by Roman Büchler 2 months ago

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.

#7 Updated by Riccardo De Contardi 2 months ago

  • Status changed from Needs Feedback to Closed

Closed in agreement with the reporter.

Also available in: Atom PDF