Translate builder field content inside repeater field

Hello,

I’m trying to translate the content of a builder field. This seems to work if the builder is put directly in a resource; However, when the builder is part of a repeater field being saved to another relation, translations don’t seem to be handled anymore.

The code below runs on Laravel v10.3.3 and Filament v2.17.15 in a fresh project using the first party Spatie translations plugin.


// PageResource.php

->schema([
                Forms\Components\TextInput::make('name'),
                Forms\Components\TextInput::make('slug'),
                // Translated correctly 
                Forms\Components\Builder::make('content')
                    ->blocks(static::getFlexibleContentBlocks()),
                // Translated incorrectly on save - data is not wrapped inside the locales and are not loaded 
                Forms\Components\Repeater::make('sections')
                    ->schema([
                        Forms\Components\Builder::make('content')
                            ->blocks(static::getFlexibleContentBlocks())
                    ])
                    ->relationship('sections')
                    ->columnSpanFull(),
            ]);


The static::getFlexibleContentBlocks() method simply returns the example builder blocks from the docs.

The content field is in the fillable and translatable properties in both the Page and ModelSection models.

Does anyone know a workaround for this issue?

Thanks in advance!
Was this page helpful?