F
Filamentβ€’3mo ago
st4rcruz3r

Tags & Translatable Plugin

Hi folks, i'm trying to use Filament Spatie Tags & the translatable Plugin. The Translatable Plugin runs like a charm, but how to implement the Tags to work with the translatable Plugin. I cant find anything and just to do this: public $translatable = ['description', 'location_description', 'tags']; does not work. Thx for ur help
10 Replies
st4rcruz3r
st4rcruz3rOPβ€’3mo ago
No one? Or is it too easy and not worth mentioning? πŸ˜‰
awcodes
awcodesβ€’3mo ago
tags are their own separate model so you'll also need to make them translatable on that model too.
st4rcruz3r
st4rcruz3rOPβ€’3mo ago
Ok, so I extend the Tags class and add $translatable to it. ill try
awcodes
awcodesβ€’3mo ago
looks like it's built into the spatie tags package, you might need to override the creating / updating for the field instead. https://spatie.be/docs/laravel-tags/v4/advanced-usage/adding-translations
awcodes
awcodesβ€’3mo ago
haven't really looked into the filament plugin to see if it's available out of the box but i'm not seeing anything in the docs of the plugin about it.
st4rcruz3r
st4rcruz3rOPβ€’3mo ago
I dont see something either, Both are official Filament plugins, but they dont seem to work together? Well, I found out, When im using the original TagsInput it does not work either. I added everything, made a new column called tags, added it to the $translatable. And it works, until I use the Language Switcher from the Translatable Plugin. Enter on the TagsInput does not work anymore. On a normal TextInput it works like a charm.
awcodes
awcodesβ€’3mo ago
hmm. yea, sorry, not totally sure at the moment. don't do much with either of them.
Lara Zeus
Lara Zeusβ€’3mo ago
can you test with this fork https://github.com/lara-zeus/translatable it should be working
st4rcruz3r
st4rcruz3rOPβ€’2mo ago
I have this in my model
use HasFactory, HasTags, HasTranslations;

protected $guarded = [];

protected $casts = [
'images' => 'array',
];

public $translatable = ['description', 'location_description', 'tags'];
use HasFactory, HasTags, HasTranslations;

protected $guarded = [];

protected $casts = [
'images' => 'array',
];

public $translatable = ['description', 'location_description', 'tags'];
that doesn't work at all Works with TagsInput, but not with the SpatieTagsInput. All good
Lara Zeus
Lara Zeusβ€’2mo ago
using my fork? if yes can you open an issue in github and will look into it.
Want results from more Discord servers?
Add your server