FilamentF
Filamentβ€’5mo ago
charlie

Make settings translatable

Hi everyone!

I'm struggling to make my settings translatable.

I currently use:
  • Filament v4
  • larazeus/spatie-translatable
  • rawilk/laravel-settings
I managed to make models attributes translatables, as well as static content. But I have a lot of settings in a Filament Custom page, and I really have no idea how to make these translatable since they're not from a regular model, or in a regular resource...

To be perfectly clear, what I want is to let users translate themselves the dynamic strings in the settings page.
E.g. you have a setting named "Hero title".
How do I let users have multilingual content in it?

Thanks for your help! πŸ™‚
Solution
The Spatie Translatable package handles the logic for setting/getting the translatable values. If that package doesn't work with attributes, you can't use that and need to roll your own solution.

Maybe you can use it's "Context" feature:
https://randallwilk.dev/docs/laravel-settings/v3/basic-usage/contextual-settings
Was this page helpful?