Skip to content

Commit 4ade82d

Browse files
authored
[TASK] Support auto-registration of set labels from labels.xlf (#737)
The set language files introduced in https://forge.typo3.org/issues/104831 are now auto-loaded from labels.xlf within the sets folder, if the file is provided and the set configuration does not reference an explicit labels xlf file.
1 parent 6d2238f commit 4ade82d

File tree

6 files changed

+1450
-8
lines changed

6 files changed

+1450
-8
lines changed

packages/typo3-docs-theme/src/Directives/SiteSetSettingsDirective.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,16 @@ public function processNode(
8383
}
8484

8585
$labelContents = '';
86-
if ($labelsFile) {
87-
// Asume all EXT: references are relative to the rendered PROJECT
88-
$labelsFile = preg_replace('/^EXT:[^\/]*\//', 'PROJECT:/', $labelsFile);
89-
try {
90-
$labelContents = $this->loadFileFromDocumentation($blockContext, $labelsFile);
91-
} catch (FileLoadingException $exception) {
92-
// ignore, config.yaml isn't required
93-
}
86+
// Asume all EXT: references are relative to the rendered PROJECT
87+
$labelsFile = $labelsFile ?
88+
preg_replace('/^EXT:[^\/]*\//', 'PROJECT:/', $labelsFile) :
89+
dirname($setConfigurationFile) . '/labels.xlf';
90+
try {
91+
$labelContents = $this->loadFileFromDocumentation($blockContext, $labelsFile);
92+
} catch (FileLoadingException $exception) {
93+
// ignore, labels.xlf isn't required
9494
}
95+
9596
$labels = [];
9697
$descriptions = [];
9798
if ($labelContents) {

0 commit comments

Comments
 (0)