Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Missing site attribute in request with TYPO3 12.4.9 #2145

Open
jonakieling opened this issue Dec 14, 2023 · 3 comments
Open

BUG: Missing site attribute in request with TYPO3 12.4.9 #2145

jonakieling opened this issue Dec 14, 2023 · 3 comments

Comments

@jonakieling
Copy link

Hi there,

we encounter an exception with Flux 10.0.8 and TYPO3 12.4.9:

Call to a member function getDefaultLanguage() on null

(null is expected to be a site)

Describe the bug
Any use of LocalizationUtility within a Flux template (e.g. f:translate within a configuration section) will lead to the exception.

Additional context

This change in TYPO3 Core uses the request type to decide how to get a locale and uses the requests site attribute for frontend requests: TYPO3/typo3@490f12697b

This is always creating a frontend request with the site attribute missing:
https://github.com/FluidTYPO3/flux/blob/development/Classes/Builder/RequestBuilder.php#L85

To Reproduce
Steps to reproduce the behavior:

  1. Install Flux 10.0.8 and TYPO3 12.4.9
  2. Have a provider Extension registered
  3. Create a Flux Element with a f:translate ViewHelper in the configuration section
  4. Load Page module
@jonakieling jonakieling changed the title BUG: Usage of removed TYPO3_REQUESTTYPE BUG: Missing site attribute in request with TYPO3 12.4.9 Dec 14, 2023
@NamelessCoder
Copy link
Member

Not to dismiss the problem, but: you should not be using f:translate within Configuration sections - ideally you should rely on the automatic building of field labels, or use full label references with LLL:EXT:... syntax. And in general, you should not be using f:translate in anything that runs in backend context.

@magicsunday
Copy link

magicsunday commented Feb 9, 2024

This also fails for TYPO3 v12.4.10, Flux 10.0.9.

ideally you should rely on the automatic building of field labels

What does this mean?

or use full label references with LLL:EXT:...

This fails with the same error.

For instance:

<flux:field.custom name="settings.Banner.description">
    <div class="alert alert-info">
        <v:l key="LLL:EXT:ext_name/Resources/Private/Language/locallang.xlf:flux.Banner.description"/>
    </div>
</flux:field.custom>

And in general, you should not be using f:translate in anything that runs in backend context.

So what is the recommended way to translate the backend? TYPO3 itself uses f:translate too

@Gitsko
Copy link

Gitsko commented Apr 25, 2024

Hi @NamelessCoder ,

do you see another alternative if I want to use a translated element (f:translate) e.g. with a flux:field.custom element output a hint box for an editor ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants