Skip to content

Commit 51d4c1d

Browse files
sarahmccarthy123linawolfbrotkrueml
authored
[FEATURE] Allow adding inline language domains to JavaScript #1530 (#6368)
* [FEATURE] Allow adding inline language domains to JavaScript #1530 Resolves: TYPO3-Documentation/Changelog-To-Doc#1530 Releases: main * [TASK] Fix cgl Releases: main * Update Documentation/ApiOverview/Backend/BroadcastChannels.rst Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestions from code review --------- Co-authored-by: Lina Wolf <48202465+linawolf@users.noreply.github.com> Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
1 parent e3fe2ed commit 51d4c1d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Documentation/ApiOverview/Backend/BroadcastChannels.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ Example code:
7575
.. literalinclude:: _BroadcastChannels/_BackendControllerHook.php
7676
:caption: EXT:my_extension/Classes/Hooks/BackendControllerHook.php
7777

78+
.. versionadded:: 14.1
79+
The new method :php:`PageRenderer->addInlineLanguageDomain()`
80+
(class :php:`TYPO3\CMS\Core\Page\PageRenderer`)
81+
is used to load labels from a language domain and make them available in
82+
JavaScript through the :javascript:`TYPO3.lang` object. The older method
83+
:php:`PageRenderer->addInlineLanguageLabelFile()` is
84+
still valid for legacy, file-based labels.
85+
7886
.. code-block:: yaml
7987
:caption: EXT:my_extension/Configuration/Services.yaml
8088

Documentation/ApiOverview/Backend/_BroadcastChannels/_BackendControllerHook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public function registerClientSideEventHandler(): void
1717
$this->pageRenderer->loadJavaScriptModule(
1818
'@myvendor/my-extension/event-handler.js',
1919
);
20-
$this->pageRenderer->addInlineLanguageLabelFile(
21-
'EXT:my_extension/Resources/Private/Language/locallang_slug_service.xlf',
20+
$this->pageRenderer->addInlineLanguageDomain(
21+
'my_extension.slug_service',
2222
);
2323
}
2424
}

0 commit comments

Comments
 (0)