Translate Action for Filament Admin
MIT License
Translate your models with a single action click via DeepL.
composer require pxlrbt/filament-translate-action
Setup a free account on DeepL. You can get your API key from your account page: https://www.deepl.com/de/account/summary.
Then configure the API key in your AppServiceProvider
:
use pxlrbt\FilamentTranslateAction\Filament\Actions\TranslateAction
public function boot(): void
{
// ...
TranslateAction::apiKey('your-api-key');
// ...
}
Add the action to the header actions for your page. You can specify the sourceLocale
otherwise it will default to en
.
class EditUser extends \Filament\Resources\Pages\EditRecord
{
// ...
protected function getHeaderActions(): array
{
return [
TranslateAction::make()
->sourceLocale('de'),
];
}
}
If you want to contribute to this packages, you may want to test it in a real Filament project:
/filament-translate-action
directory, create a branch for your fix, e.g. fix/error-message
.Install the packages in your app's composer.json
:
"require": {
"pxlrbt/filament-translate-action": "dev-fix/error-message as main-dev",
},
"repositories": [
{
"type": "path",
"url": "filament-translate-action"
}
]
Now, run composer update
.