Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Enable translations for overridden selectbox options #3395

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

grebaldi
Copy link
Contributor

@grebaldi grebaldi commented Aug 1, 2021

What I did / How I did it

I altered the NodeTypeConfigurationEnrichmentAspect so that it takes the node type inheritance chain into account when translating select box option labels in the respective inspector editor configuration.

This addresses an issue originally reported in the UI repo: neos/neos-ui#2005

How to verify it

You'll need a mixin NodeType that provides a select box property with internationalized option labels like this:

    brandColor:
      type: string
      defaultValue: 'primary'
      ui:
        label: i18n
        reloadIfChanged: true
        inspector:
          group: style
          position: 10
          editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor'
          editorOptions:
            values:
              'primary':
                label: i18n
              'turquoise':
                label: i18n
              'gray-dark':
                label: i18n
              'gray-light':
                label: i18n
              'toyota-red':
                label: i18n
              'yellow':
                label: i18n

(let's call this one Vendor.Site:Mixin.BrandColor)

Then you'll need a second node type that inherits from Vendor.Site:Mixin.BrandColor and adds an new internationalized option to the property brandColor:

    brandColor:
      defaultValue: 'none'
      ui:
        inspector:
          editorOptions:
            values:
              'none':
                label: 'i18n'

Before the fix the new option will show up as a plain string "i18n".
After the fix the new option will show up as an XLIFF-translation address (bound to the node type that added the option).

Additional remarks

Imho, the entire NodeTypeConfigurationEnrichmentAspect should actually be moved out of the Neos.Neos package and into the UI package (All of these translations are an exclusive UI concern). Doing that would be out-of-scope for a bugfix though.

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
    • To be precise: There are no tests for this aspect to begin with and would be extremely difficult to add them. I'd suggest to move this concern over to the UI and handle it in a more testable manner.
  • The PR is created against the lowest maintained branch

Copy link
Member

@kdambekalns kdambekalns 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 by reading

Copy link
Member

@markusguenther markusguenther left a comment

Choose a reason for hiding this comment

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

Works like expected. Thanks @grebaldi for tackling that issue :)

@markusguenther
Copy link
Member

Before:

Screenshot 2021-10-12 at 23 13 22

And after:

Screenshot 2021-10-12 at 23 12 06

@markusguenther markusguenther merged commit 67fa7a5 into neos:5.3 Oct 12, 2021
reflexxion added a commit to ideenstadtwerke/neos-development-collection that referenced this pull request Nov 23, 2021
When there are disabled `superTypes` in NodeTypes, an exception is thrown.
This happens when a superType is disabled in a NodeType and no specific editor is defined.

```yaml
'My.Package:FormElement':
  superTypes:
    'Neos.Form.Builder:FormElement': true
    'Neos.Form.Builder:LabelMixin': false
    'Neos.Form.Builder:RequiredCheckboxMixin': false
  properties:
    property:
      type: string
      ui:
        label: i18n
```

This issue was introduced in neos#3395
neos-bot pushed a commit to neos/neos that referenced this pull request Nov 25, 2021
When there are disabled `superTypes` in NodeTypes, an exception is thrown.
This happens when a superType is disabled in a NodeType and no specific editor is defined.

```yaml
'My.Package:FormElement':
  superTypes:
    'Neos.Form.Builder:FormElement': true
    'Neos.Form.Builder:LabelMixin': false
    'Neos.Form.Builder:RequiredCheckboxMixin': false
  properties:
    property:
      type: string
      ui:
        label: i18n
```

This issue was introduced in neos/neos-development-collection#3395
neos-bot pushed a commit to neos/neos that referenced this pull request Oct 7, 2022
When there are disabled `superTypes` in NodeTypes, an exception is thrown.
This happens when a superType is disabled in a NodeType and no specific editor is defined.

```yaml
'My.Package:FormElement':
  superTypes:
    'Neos.Form.Builder:FormElement': true
    'Neos.Form.Builder:LabelMixin': false
    'Neos.Form.Builder:RequiredCheckboxMixin': false
  properties:
    property:
      type: string
      ui:
        label: i18n
```

This issue was introduced in neos/neos-development-collection#3395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants