Skip to content

Conversation

@bijusk
Copy link
Contributor

@bijusk bijusk commented Oct 24, 2025

Added translation support for labels of autocreated childNodes

Example:

yaml-File:

'Neos.Demo:Content.Columns.Two':
  ...
  childNodes:
    column0:
      type: 'Neos.Demo:Collection.Content.Column'
      label: i18n
    column1:
      type: 'Neos.Demo:Collection.Content.Column'
      label: i18n

xlf-file:

...
<trans-unit id="childNodes.column0" xml:space="preserve">
	<source>Left Column</source>
</trans-unit>
<trans-unit id="childNodes.column1" xml:space="preserve">
	<source>Right Column</source>
</trans-unit>
...

Changes:

Added childNode labels in addLabelsToNodeTypeConfiguration in NodeConfigurationEnrichmentAspect and implemented function for transforming i18n to a later translated id

Implemented translating of said id to the actual translation in ExpressionBasedNodeLabelGenerator in function getLabel

resolved: #5643

Environment

- Flow: 8.4
- Neos: 8.4
- PHP: 8.3

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@Sebobo Sebobo self-requested a review October 24, 2025 09:11
Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, works great. Just one small change necessary, which basically everyone forgets when doing something with nodetype configs ;)

{
$nodeTypeLabelIdPrefix = $this->generateNodeTypeLabelIdPrefix($nodeTypeName);
foreach ($configuration['childNodes'] as $childNodeName => &$childNodeConfiguration) {
if ($this->shouldFetchTranslation($childNodeConfiguration)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($this->shouldFetchTranslation($childNodeConfiguration)) {
if ($childNodeConfiguration && $this->shouldFetchTranslation($childNodeConfiguration)) {

Nodetype settings are always nullable in subtypes f.e.. So we always have to catch this case. Currently this would lead to an exception and make it impossible to overwrite a child node from a subtype.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for catching this! Comitted a fix where I also removed an unnecessary function argument

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thx!

@Sebobo Sebobo requested review from ahaeslich and dlubitz October 30, 2025 08:22
Copy link
Contributor

@dlubitz dlubitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. Looks good by reading. I left two suggestions to make it more type safe.

Sebobo added a commit to neos/Neos.Demo that referenced this pull request Dec 12, 2025
This change relies on the feature introduced into Neos 8.4 and requires neos/neos-development-collection#5667
Sebobo added a commit to neos/Neos.Demo that referenced this pull request Dec 12, 2025
This change relies on the feature introduced into Neos 8.4 and requires neos/neos-development-collection#5667
@Sebobo Sebobo self-assigned this Dec 12, 2025
@Sebobo Sebobo moved this to In review in Neos 9.1 Release Board Dec 14, 2025
@Sebobo Sebobo merged commit 26ef0fb into neos:8.4 Dec 14, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Neos 9.1 Release Board Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants