F
Filamentβ€’8mo ago
WEBMAS

How to display fields with different languages in one form without a language switcher?

Hello. I use this plugin https://filamentphp.com/plugins/filament-spatie-translatable How to display fields with different languages in one form without a language switcher? return $form ->schema([ Forms\Components\Section::make() ->schema([ Forms\Components\TextInput::make('title') ->label('(English) Title') ->required() ->maxLength(255), Forms\Components\TextInput::make('title') ->label('(Hindi) Title') ->required() ->maxLength(255), Forms\Components\TextInput::make('title') ->label('(Spanish) Title') ->required() ->maxLength(255), ...
12 Replies
mvenghaus
mvenghausβ€’8mo ago
you can use my plugin πŸ™‚
mvenghaus
mvenghausβ€’8mo ago
Filament
Translatable Inline by Marcus Venghaus - Filament
Addon for Spatie Translatable Plugin to edit translations directly below the field
WEBMAS
WEBMASOPβ€’8mo ago
Hm. Thank you. Is this the only similar solution? How to divide it into several fields, for example: return $form ->schema([ Forms\Components\Section::make() ->schema([ Forms\Components\TextInput::make('title') ->label('(English) Title') ->local('en') // <--- ->required() ->maxLength(255), Forms\Components\TextInput::make('title') ->label('(Hindi) Title') ->local('hi') // <--- ->required() ->maxLength(255), ... OR return $form ->schema([ Forms\Components\Section::make() ->schema([ Forms\Components\TextInput::make('title.en') // <--- ->label('(English) Title') ->required() ->maxLength(255), Forms\Components\TextInput::make('title.hi') // <--- ->label('(Hindi) Title') ->required() ->maxLength(255), ...
mvenghaus
mvenghausβ€’8mo ago
you can replace the casting spatie's module is doing .. result should be an array .. but you can cast it from different fields
WEBMAS
WEBMASOPβ€’8mo ago
Can you make a working example please? It's still hard for me to understand.
mvenghaus
mvenghausβ€’8mo ago
sorry .. no time for that at the moment .. tomorrow just make sure your data is that kind of array .. convert you data before and after back
WEBMAS
WEBMASOPβ€’8mo ago
I will be very grateful if you can make a working example tomorrow. Thank you. And it would be great to add this feature to your plugin. Hello. Can you make an example today? (
Lara Zeus
Lara Zeusβ€’8mo ago
make sure you cast to array and the second one should work there is many ways to do it this is an example: I am using tabs in blade file in each tab there is a text input and cast title to array https://github.com/lara-zeus/chaos/blob/1.x/src/Forms/Components/MultiLang.php
GitHub
chaos/src/Forms/Components/MultiLang.php at 1.x Β· lara-zeus/chaos
opinionated filament setup. Contribute to lara-zeus/chaos development by creating an account on GitHub.
WEBMAS
WEBMASOPβ€’8mo ago
Thank you. Please show me an example of using the MultiLang Component. And a screenshot of what UI looks like.
Lara Zeus
Lara Zeusβ€’8mo ago
MultiLang::make('title)
No description
WEBMAS
WEBMASOPβ€’8mo ago
It would be great if there was such a plugin with advanced settings.
Lara Zeus
Lara Zeusβ€’8mo ago
create one πŸ™‚
Want results from more Discord servers?
Add your server