Skip to content

Avoid translating empty values when using events #21

@Teddytrombone

Description

@Teddytrombone

It's great we can use the CanFieldBeTranslatedCheckEvent to change if a field can be translated. The problem though is that the event doesn't know anything about the field's value.
For example: we use a custom renderType for previewing SERPs for fields like seo_title or description which leads to dd_deepl not to translate the description field of pages. So we created an event, which enables this. Of course we could have used translateWithDeepl in this case, but this is not always applicable.
So as we use the event, we force the translation for all description fields, even for pages of type 'folder'. But the description there is null which leads to an error, as DeeplTranslationService->translateFieldInternal expects a string for $fieldValue.

I would suggest to add the fieldValue to the event (and maybe some information why the result has the value it has?) or make some sanity checks so that even if overridden by an event no empty/null values are passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions