slimdeluxe
slimdeluxe
FFilament
Created by slimdeluxe on 2/24/2024 in #❓┊help
How to set the default content language when using the Translatable plugin?
I added the Spatie Translatable plugin and everything works, but I am looking for a way to set the default language that is used for the content. E.g. when I use the switcher to change the language to Slovenian and then proceed to open the Edit page for a record, the editor should also open in the same language. Also when I go back to the list, should be the same. Basically I am looking how to persist the language choice so that when you are working with a translation, you don't have to keep switching the language for every page load. I tried setting the Laravel locale config in app.php but this is not used as a default choice for the content language. The plugin is initialized like so:
$panel->plugin(SpatieLaravelTranslatablePlugin::make()
->defaultLocales(['en', 'sl']));
$panel->plugin(SpatieLaravelTranslatablePlugin::make()
->defaultLocales(['en', 'sl']));
I don't see any specific option on the plugin object. It's weird however that the method is called "defaultLocales"... maybe it should be "availableLocales" to make it more clear 🙂
2 replies