Skip to content

Translations are going too deep #44

@AIC-BV

Description

@AIC-BV

When adding a key to the $translatable array:

$translatable = [
    'title', 'image', ...
];

I noticed that the translation is picking up all title/image/... fields
What I mean with this is that when you have the following structure (simplified it):

title:
    label: Title field
repeater:
    form:
        fields:
            data:
                type: nestedForm
                    form:
                        fields:
                            title:
                                label: Title field in repeater

The translation will pick up [title] but also repeater[x][data][title].
Meaning [title] will always have the value of repeater[lastIndex][data][title].
This also occurs with my image (which I posted about in Discord), which is why when removing [image] is not working because the translation is saving repeater[lastIndex][data][image] in my [image] field

I would expect it would only pick the title/image field located in Plugin[image] and that fields inside a jsonable field are ignored.

The workaround is to create unique keys. Instead of title in repeater, use repeater_title, ...
Note that repeater[x][data][title] is also getting the locale switcher thingy

image
Note how RLTranslate sets image on the Blog[image] but also on Blog[blocks][0][data][image]
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions