FilamentF
Filamentβ€’5mo ago
Excavator

Spatie translatable

I'm using https://github.com/filamentphp/spatie-laravel-translatable-plugin to translate some fields in my models - is there a suggested way to actually render those on the frontend?

Should this be done by the plugin, or do I just process data before passing to props/just render in React depending on the locale? I see a bunch of different "translatable" plugins mentioned, so I'm not sure if I'm using the "wrong" one? If there's such thing as wrong even πŸ˜„
GitHub
[READ ONLY] Subtree split of the Filament spatie/laravel-translatable Plugin (see filamentphp/filament) - filamentphp/spatie-laravel-translatable-plugin
Solution
as Dennis mentioned the plugin handle the filament part only. the frontend is out of control haha

your best way to create accessors to get the translated attributes depend on your app, $this-title will return array, so you also can create a method and pass the $lang

btw not sure if you're on v4 or v3, since this is for v4
GitHub
Contribute to lara-zeus/spatie-translatable development by creating an account on GitHub.
Was this page helpful?