Translatable plugin locale switcher not working
I have installed the Spatie Translatable plugin v3.2, followed the instructions in the Filament and Spatie documentation, and set up my resource to translate columns on a relationship called "meta." I'm also using Spatie's Sluggable package and have set slugs up for translation per the documentation. Before using the translation plugin, slugs were working fine. I have two problems at the moment:
1. The locale switcher defaults to English, whereas my current app locale is actually Spanish. How do I get the locale switcher to sync with what my current locale is?
2. When I switch locales, the translatable fields all go blank. Looking in the database, the data is there, exactly like the English data (added via a Seeder). E.g. for my title column:
{"en": "Course", "es": "Curso"}
. Here is the relevant area in the form:
4 Replies
Did you add the spatie use to your resource pages?
Yes, I followed the instructions in the documentation from Filament and Spatie, including adding the proper traits to the resource pages.
I think the problem is coming from the fact that I'm using a relationship. I've been able to duplicate this problem in a fresh installation with no other plugins. The "meta" relationship works fine without the translatable plugin, but I'm not sure how to use it with the plugin, e.g. in the
$translatable
array, should I put "meta" or meta.title, meta.description, etc.? Also, should I change what trait I'm using in the resource pages because it's a relationship?Did you ever figure this out? I'm running in to the same issue
I've not figured this out yet, but I plan on looking into it and posting my solution when I get time.