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

Placeholder "i18n" for string properties in inspector is not replaced anymore #3249

Closed
Sebobo opened this issue Dec 15, 2020 · 12 comments
Closed
Assignees
Labels

Comments

@Sebobo
Copy link
Member

Sebobo commented Dec 15, 2020

Description

For string properties usually no editor is defined in the nodetype config and by default Neos uses the TextFieldEditor.

But in the NodeTypeConfigurationEnrichmentAspect the i18n value is not converted to a translatable
id anymore because the $editorName doesn't seem to be set yet.

I assume it's because enrichNodeTypeLabelsConfiguration happens before enrichNodeTypeConfiguration.
There were some related changes in Neos 5.

It works again when setting the editor manually to `Neos.Neos/Inspector/Editors/TextFieldEditor´.

Steps to Reproduce

  1. Go to SEO tab in the inspector
  2. Look at Creator handle Twitter card field

Expected behavior

The placeholder in the textfield editor should have been replaced

Actual behavior

The field only says has "i18n" as placeholder

Affected Versions

Neos: 5.x

@Sebobo Sebobo added the Bug label Dec 15, 2020
@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

Seems this is due to 7ecdc07

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

@mficzel @kitsunet I think you worked with Fiach on the NodeTypeConfigurationEnrichmentAspect in Vienna.

By separating setting editor defaults from setting the labels, some labels cannot be set correctly anymore as they are missing the editorconfig.

Not sure how to approach this issue right now.

@mficzel
Copy link
Member

mficzel commented Dec 15, 2020

Probably an error, the conversion of i18n labels is all the NodeTypeConfigurationEnrichmentAspect should still do.

Wait: Do the editor configurations in the settings use "i18n". I would consider this buggy and rather use a full translation identifier.

@mficzel
Copy link
Member

mficzel commented Dec 15, 2020

I just checked. The property editor configurations from settings do not use "i18n" at all. I would recommend to use full identifiers in presets that are applied to multiple nodetypes. i18n only works directly in NodeTypes.yaml.

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

@mficzel i18n worked everywhere before (which I like), and with the mentioned change it stopped working in one place.
The full one would of course works but we never enforced the full translation identifier anywhere.

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

@mficzel what do you mean with Settings?
It's related to node types and there it's broken now.

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

So full example:

Broken placeholder:

properties:
    myString:
      type: string
      ui:
        label: i18n
        inspector:
          editorOptions:
            placeholder: i18n

Working placeholder:

properties:
    myString:
      type: string
      ui:
        label: i18n
        inspector:
          editor: 'Neos.Neos/Inspector/Editors/TextFieldEditor'
          editorOptions:
            placeholder: i18n

Working placeholder:

properties:
    myString:
      type: string
      ui:
        label: i18n
        inspector:
          editorOptions:
            placeholder: 'fullIdentifier...'

@mficzel
Copy link
Member

mficzel commented Dec 15, 2020

I mean the Setting in Neos.Neos.userInterface.inspector.dataTypes those do not use i18n.

The problem with the i18n behavior is that it can only be evaluated while the nodetype is prepared as it is relative to the nodetype that it is defined on and not the nodetype that evenually uses it (which is a problem for things that are not in NodeTypes.yaml). That is the reason why this still is in the aspect.

In short if the "i18n" is in NodeTypes.yaml it should be replaced. Looking at the "twitterCardCreator" setting i would expect this to work and consider it a bug if not. Probably some refactoring error in the NodeTypeConfigurationEnrichmentAspect.

If it is in a Settings and gets merged into the configuration by a postprocessor i18n cannot work and as far as i know did also not work in the past.

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

The difference is now that with the mentioned change first the editor defaults were merged and then the labels generated.

Now it's the other way around and the label generator doesn't know which editor should be used for simple string props to generate the full id.
This only affects the placeholder from what I see.

@mficzel
Copy link
Member

mficzel commented Dec 15, 2020

Hmm ... applyEditorLabels looks very specific to me and probably should be removed entirely.

I wonder wether something similar to https://github.com/neos/neos-development-collection/blob/master/Neos.Neos/Classes/Aspects/NodeTypeConfigurationEnrichmentAspect.php#L110-L112 for inspectorEditors would be enough already and applyEditorLabels is just obsolete.

@Sebobo
Copy link
Member Author

Sebobo commented Dec 15, 2020

If we generate the id for properties.twitterCardType.editorOptions.placeholder it would also be easier, because it shouldn't matter in the localisation file which editor I use.

@mficzel
Copy link
Member

mficzel commented Dec 15, 2020

Makes sense to me so let us just add a line to handle i18n for ui.inspector.editorOptions.placeholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants