When using the package like described in the basic usage section all tags will be stored in the locale your app is running. If you're creating a multilingual app it's really easy to translate the tags. Here's a quick example.
$tag = Tag::findOrCreate('my tag');
$tag->setTranslation('name', 'fr', 'mon tag');
$tag->setTranslation('name', 'nl', 'mijn tag');
$tag->save();
$tag->getTranslation('name', 'fr');
$tag->name
The translations of the tags are stored in the name
column of the tags
table. It's a json
column. To find a tag with a specific translation you can just use Laravel's query builder which has support for json
columns.
\Spatie\Tags\Tag::query()
->where('name->fr', 'mon tag')
->first();
Behind the scenes spatie/laravel-translatable is used. You can use any method provided by that package.