Skip to content

Commit 3da47c1

Browse files
authored
[TASK] Use translation domain (#319)
* [TASK] Use translation domain Related: TYPO3-Documentation/Changelog-To-Doc#1370 Releases: main * Breaking: #92289 - Decouple logic of ResourceFactory into StorageRepository Releases: main
1 parent 1631a33 commit 3da47c1

37 files changed

+164
-162
lines changed

Classes/Controller/AdminModuleController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
4444
$allowedOptions = [
4545
'function' => [
4646
'debug' => htmlspecialchars(
47-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:debug'),
47+
$languageService->sL('examples.admin_module.mod:debug'),
4848
),
4949
'password' => htmlspecialchars(
50-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:password'),
50+
$languageService->sL('examples.admin_module.mod:password'),
5151
),
5252
'index' => htmlspecialchars(
53-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:index'),
53+
$languageService->sL('examples.admin_module.mod:index'),
5454
),
5555
],
5656
];
@@ -63,24 +63,24 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
6363
$moduleTemplate = $this->moduleTemplateFactory->create($request);
6464
$this->setUpDocHeader($request, $moduleTemplate);
6565

66-
$title = $languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang_mod.xlf:mlang_tabs_tab');
66+
$title = $languageService->sL('examples.admin_module.mod:mlang_tabs_tab');
6767
switch ($moduleData->get('function')) {
6868
case 'debug':
6969
$moduleTemplate->setTitle(
7070
$title,
71-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.debug'),
71+
$languageService->sL('examples.admin_module.mod:module.menu.debug'),
7272
);
7373
return $this->debugAction($request, $moduleTemplate);
7474
case 'password':
7575
$moduleTemplate->setTitle(
7676
$title,
77-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.password'),
77+
$languageService->sL('examples.admin_module.mod:module.menu.password'),
7878
);
7979
return $this->passwordAction($request, $moduleTemplate);
8080
default:
8181
$moduleTemplate->setTitle(
8282
$title,
83-
$languageService->sL('LLL:EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.log'),
83+
$languageService->sL('examples.admin_module.mod:module.menu.log'),
8484
);
8585
return $this->indexAction($request, $moduleTemplate);
8686
}

Classes/Controller/FalExampleController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@
1717

1818
use Psr\Http\Message\ResponseInterface;
1919
use TYPO3\CMS\Core\Resource\ResourceFactory;
20+
use TYPO3\CMS\Core\Resource\StorageRepository;
2021
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
2122

2223
/**
2324
* Class FalExampleController
2425
*/
2526
class FalExampleController extends ActionController
2627
{
27-
public function __construct(protected ResourceFactory $resourceFactory) {}
28+
public function __construct(
29+
protected ResourceFactory $resourceFactory,
30+
protected StorageRepository $storageRepository,
31+
) {}
2832
/**
2933
* Displays a list of links to the other actions.
3034
*/
@@ -38,7 +42,7 @@ public function indexAction(): ResponseInterface
3842
*/
3943
public function listFilesAction(): ResponseInterface
4044
{
41-
$defaultStorage = $this->resourceFactory->getDefaultStorage();
45+
$defaultStorage = $this->storageRepository->getDefaultStorage();
4246
if ($defaultStorage) {
4347
$folder = $defaultStorage->getFolder('/user_upload/images/galerie/');
4448
$files = $defaultStorage->getFilesInFolder($folder);

Classes/Controller/ModuleController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,27 +602,27 @@ protected function initializeModuleTemplate(
602602
'flash' => [
603603
'controller' => 'Module',
604604
'action' => 'flash',
605-
'label' => $this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang.xlf:module.menu.flash'),
605+
'label' => $this->getLanguageService()->sL('examples.module.messages:module.menu.flash'),
606606
],
607607
'tree' => [
608608
'controller' => 'Module',
609609
'action' => 'tree',
610-
'label' => $this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang.xlf:module.menu.tree'),
610+
'label' => $this->getLanguageService()->sL('examples.module.messages:module.menu.tree'),
611611
],
612612
'clipboard' => [
613613
'controller' => 'Module',
614614
'action' => 'clipboard',
615-
'label' => $this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang.xlf:module.menu.clipboard'),
615+
'label' => $this->getLanguageService()->sL('examples.module.messages:module.menu.clipboard'),
616616
],
617617
'links' => [
618618
'controller' => 'Module',
619619
'action' => 'links',
620-
'label' => $this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang.xlf:module.menu.links'),
620+
'label' => $this->getLanguageService()->sL('examples.module.messages:module.menu.links'),
621621
],
622622
'fileReference' => [
623623
'controller' => 'Module',
624624
'action' => 'fileReference',
625-
'label' => $this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang.xlf:module.menu.fileReference'),
625+
'label' => $this->getLanguageService()->sL('examples.module.messages:module.menu.fileReference'),
626626
],
627627
];
628628
$view = $this->moduleTemplateFactory->create($request);
@@ -650,7 +650,7 @@ protected function initializeModuleTemplate(
650650
$view->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
651651

652652
$view->setTitle(
653-
$this->getLanguageService()->sL('LLL:EXT:examples/Resources/Private/Language/Module/locallang_mod.xlf:mlang_tabs_tab'),
653+
$this->getLanguageService()->sL('examples.module.mod:mlang_tabs_tab'),
654654
$context,
655655
);
656656

Classes/LinkValidator/LinkType/ExampleLinkType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public function getErrorMessage(array $errorParams): string
5050
{
5151
$lang = $this->getLanguageService();
5252
return match ($errorParams['errno'] ?? 0) {
53-
404 => $lang->sL('LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:list.report.pagenotfound404'),
53+
404 => $lang->sL('LLL:linkvalidator.messages:list.report.pagenotfound404'),
5454
// fall back to generic error message
5555
default => sprintf(
56-
$lang->sL('LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:list.report.externalerror'),
56+
$lang->sL('LLL:linkvalidator.messages:list.report.externalerror'),
5757
$errorParams['errno'],
5858
),
5959
};

Classes/Middleware/HaikuSeasonList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
final readonly class HaikuSeasonList implements MiddlewareInterface
3737
{
3838
private const SEASONS = ['spring', 'summer', 'autumn', 'winter', 'theFifthSeason'];
39-
private const TRANSLATION_PATH = 'LLL:EXT:examples/Resources/Private/Language/PluginHaiku/locallang.xlf:season.';
39+
private const TRANSLATION_PATH = 'LLL:examples.plugin_haiku.messages:season.';
4040
private const URL_SEGMENT = '/haiku-season-list.json';
4141

4242
public function __construct(

Configuration/Backend/Modules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'access' => 'user',
2727
'workspaces' => 'live',
2828
'path' => '/module/page/example',
29-
'labels' => 'LLL:EXT:examples/Resources/Private/Language/Module/locallang_mod.xlf',
29+
'labels' => 'LLL:examples.module.mod',
3030
'extensionName' => 'Examples',
3131
'iconIdentifier' => 'tx_examples-backend-module',
3232
'controllerActions' => [

Configuration/Flexforms/HtmlParser.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
<sDEF>
44
<ROOT>
55
<sheetTitle>
6-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral
6+
LLL:examples.db:examples.pi_flexform.sheetGeneral
77
</sheetTitle>
88
<type>array</type>
99
<el>
1010
<pageSelector>
1111
<label>
12-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.pageSelector
12+
LLL:examples.db:examples.pi_flexform.pageSelector
1313
</label>
1414
<config>
1515
<type>select</type>
1616
<renderType>selectSingle</renderType>
1717
<items type="array">
1818
<numIndex index="0" type="array">
1919
<numIndex index="0">
20-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage
20+
LLL:examples.db:examples.pi_flexform.choosePage
2121
</numIndex>
2222
<numIndex index="1">0</numIndex>
2323
</numIndex>

Configuration/Flexforms/PluginHaikuDetail.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<sDEF>
44
<ROOT>
55
<sheetTitle>
6-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral
6+
LLL:examples.db:examples.pi_flexform.sheetGeneral
77
</sheetTitle>
88
<type>array</type>
99
<el>
1010
<settings.listPid>
1111
<label>
12-
LLL:EXT:examples/Resources/Private/Language/PluginHaiku/locallang_db.xlf:listPageUid
12+
LLL:examples.plugin_haiku.messages:listPageUid
1313
</label>
1414
<config>
1515
<type>group</type>

Configuration/Flexforms/PluginHaikuList.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<sDEF>
44
<ROOT>
55
<sheetTitle>
6-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral
6+
LLL:examples.db:examples.pi_flexform.sheetGeneral
77
</sheetTitle>
88
<type>array</type>
99
<el>
1010
<settings.singlePid>
1111
<label>
12-
LLL:EXT:examples/Resources/Private/Language/PluginHaiku/locallang_db.xlf:singlePageUid
12+
LLL:examples.plugin_haiku.db:singlePageUid
1313
</label>
1414
<config>
1515
<type>group</type>

Configuration/Flexforms/flexform_ds1.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
<sDEF>
44
<ROOT>
55
<sheetTitle>
6-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral
6+
LLL:examples.db:examples.pi_flexform.sheetGeneral
77
</sheetTitle>
88
<type>array</type>
99
<el>
1010
<pageSelector>
1111
<label>
12-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.pageSelector
12+
LLL:examples.db:examples.pi_flexform.pageSelector
1313
</label>
1414
<config>
1515
<type>select</type>
1616
<renderType>selectSingle</renderType>
1717
<items type="array">
1818
<numIndex index="0" type="array">
1919
<numIndex index="0">
20-
LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage
20+
LLL:examples.db:examples.pi_flexform.choosePage
2121
</numIndex>
2222
<numIndex index="1">0</numIndex>
2323
</numIndex>

0 commit comments

Comments
 (0)