sharpapi/nova-ai-translator is a Laravel package.
It currently has 4 GitHub stars and 3.127 downloads on Packagist (latest version v1.0.5).
Install it with composer require sharpapi/nova-ai-translator.
Discover more Laravel packages by sharpapi
or browse all Laravel packages to compare alternatives.
Last updated
Welcome to SharpAPI AI Translator for Laravel Nova – the package that’s here to make your content translation smoother and smarter with the power of SharpAPI's Advanced Text Translator AI API and to leverage AI for Laravel. This package extends the already-awesome Spatie's laravel-translatable with a Nova action you can trigger from your resource’s edit or list views.
🤖 Initiate AI Translation can be run from either:
The Nova resources list view:
Or from the edit screen of an individual resource:
Here's the form you’ll use to dispatch the translation:
composer require sharpapi/nova-ai-translator
You’ll need an API key from SharpAPI.com. Add it to your .env file like so:
SHARP_API_KEY=your-sharp-api-key
Add your supported locales in config/app.php under the locales key:
return [
'locales' => [
'en' => 'English',
'es' => 'Spanish',
'fr' => 'French',
// Add other supported languages here
],
];
For any model you want to translate, make sure it:
HasTranslations trait.translatable.Actionable and Notifiable traits to track actions and notifications. This ensures you can log and monitor translation progress effectively.Example:
namespace App;
use Laravel\Nova\Actions\Actionable;
use Illuminate\Notifications\Notifiable;
use Spatie\Translatable\HasTranslations;
class BlogPost
{
use Actionable, Notifiable, HasTranslations;
protected $translatable = ['title', 'subtitle', 'content'];
}
Add the TranslateModel action to any Nova resource, such as BlogPost:
use SharpAPI\NovaAiTranslator\Actions\TranslateModel;
public function actions()
{
return [
(new TranslateModel())->enabled(),
];
}
The TranslateModel action runs as a queued job, which is essential for smooth, asynchronous processing. Make sure your app’s queue is up and running for best results.
TranslateModel action.Actionable and Notifiable traits.Translation logs: Helpful for tracking what was translated.
Error handling: With Laravel\Nova\Actions\Actionable, you get detailed logs if something goes awry.
See CHANGELOG for recent updates.
Licensed under the MIT License – see the License File for details.
Stay tuned for updates, tips, and tricks: