#108941Adjusting JavaScript Language Label Handling in TYPO3
Description
Problem
The JavaScript function lll (defined in https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/core/lit-helper.ts#L43) searches for the requested label in the current window and the top window. Labels in the top frame are restricted to the backend scope.
If you e.g. create a modal like this:
const content = html`
<typo3-component-with-lll-calls />
`;
Modal.advanced({
title: lll('Hello World'),
});
…and your component <typo3-component-with-lll-calls> calls `lll` for labels that exist in the current frame but not in the top frame, these labels will not be resolved.</typo3-component-with-lll-calls>
Current Workarounds
Currently, developers manually add TYPO3.lang as a custom property on modal child elements via Modal callbacks , e.g.:
form.TYPO3lang = TYPO3.lang;
and do not use the generic `lll` function, which has some drawbacks e.g. placeholders are not replaced in these cases.
Reference: https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/workspaces/workspaces.ts#L57
Proposed Solutions
1. Search Child Frames as Fallback (Quick Win?)
If a language key is not found in the current or top frame, we could search the child frames for the label:
else if (window.self === window.top) {
// fallback: search child frames for translation key
for (let i = 0; i < window.frames.length; i++) {
try {
if (typeof window.frames[i]?.TYPO3?.lang[key] === 'string') {
languagePool = window.frames[i].TYPO3.lang;
break;
}
} catch {
// cross-origin frame, skip
}
}
}
✅ Pros
- Simple and fast to implement
❌ Cons
- Language strings must still exist in the “main” frame (e.g., passed via `PageRenderer::addInlineLanguageDomain`).
2. Load Translation Keys Dynamically via AJAX
- If a key (possibly including a translation domain, e.g., form.messages:validation.error.1221565130 ( TBD : If it is possible to determine whether the key contains a translation domain? Yes: everything before `:`) is missing from TYPO3.lang, we load the translation file dynamically via an AJAX request.
- The request would pass the translation domain (e.g., form.messages).
- A TYPO3 backend controller would use LanguageService::getLabelsFromResource to return the labels.
- These labels could then be stored in a JavaScript object, e.g., `TYPO3.langByDomain` (TBD: key), and accessed via lll.
✅ Pros
- Language strings do not need to be predefined in frames; they are loaded dynamically when needed.
❌ Cons
- A new translation function may be required to support passing a translation domain (the current lll signature is (key: string, …args: any[]) and cannot accept additional parameters).
- Implementation is more complex.
Reviews 9
- main 92871[TASK] Use shared label for collapse_state_search.numberOfSearchMatches
- main 92925[TASK] Support ICU MessageFormat in JavaScript label API
- main 92935[TASK] Generate types for placeholders in JavaScript label API
- main 92868[TASK] Use JavaScript label imports in EXT:extensionmanager
- main 92867[TASK] Use JavaScript label imports in EXT:dashboard
- main 92815[TASK] Migrate bookmark modules to use JavaScript label modules
- main 92865[TASK] Add virtual label provider for JavaScript unit tests
- main 92810[FEATURE] Provide language labels as virtual JavaScript modules
- main 92817[TASK] Deprecate `PageRenderer->addInlineLanguageDomain()`
History 914
-
Tobias Wojtylak changed description <span data-processor="relativetime" data-value="2026-02-11T13:32:54+00:00" > 02/11/26, 13:32 </span>
-
Tobias Wojtylak changed description <span data-processor="relativetime" data-value="2026-02-11T13:33:40+00:00" > 02/11/26, 13:33 </span>
-
Tobias Wojtylak changed description <span data-processor="relativetime" data-value="2026-02-11T13:35:47+00:00" > 02/11/26, 13:35 </span>
-
Tobias Wojtylak changed description <span data-processor="relativetime" data-value="2026-02-11T15:54:01+00:00" > 02/11/26, 15:54 </span>
-
Benjamin Franzke commented <span data-processor="relativetime" data-value="2026-02-12T08:21:15+00:00" > 02/12/26, 08:21 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 92810 status
NewUnder Review <span data-processor="relativetime" data-value="2026-02-12T13:48:53+00:00" > 02/12/26, 13:48 </span> -
Gerrit Code Review pushed patch set 7 for main to change 92810 <span data-processor="relativetime" data-value="2026-02-13T09:35:30+00:00" > 02/13/26, 09:35 </span>
-
Gerrit Code Review pushed patch set 8 for main to change 92810 <span data-processor="relativetime" data-value="2026-02-13T09:36:16+00:00" > 02/13/26, 09:36 </span>
-
Gerrit Code Review pushed patch set 9 for main to change 92810 <span data-processor="relativetime" data-value="2026-02-13T10:10:00+00:00" > 02/13/26, 10:10 </span>
-
Gerrit Code Review pushed patch set 10 for main to change 92810 <span data-processor="relativetime" data-value="2026-02-16T09:09:10+00:00" > 02/16/26, 09:09 </span>
-
Benjamin Franzke commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-02-16T13:55:08+00:00" > 02/16/26, 13:55 </span>Applied in changeset commit:455b3654941169be492274dac2b29a2673b754a5.
-
Benjamin Franzke changed Related to #109064 <span data-processor="relativetime" data-value="2026-02-23T07:57:41+00:00" > 02/23/26, 07:57 </span>
-
Benjamin Franzke changed tracker
TaskFeature subjectRFC: Adjusting JavaScript Language Label Handling in TYPO3Adjusting JavaScript Language Label Handling in TYPO3 parent task #109064 TYPO3 Version14<span data-processor="relativetime" data-value="2026-02-23T08:00:04+00:00" > 02/23/26, 08:00 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-03-31T08:11:00+00:00" > 03/31/26, 08:11 </span>
Third solution:
Provide virtual JavaScipt module(s) for labels
Advantages over an ajax endpoint:
Here is a Demo:
92810: [WIP][FEATURE] Provide language label domains as virtual javascript modules | https://review.typo3.org/c/Packages/TYPO3.CMS/+/92810