jayesh / laravel-gemini-translator
An interactive command to extract and generate Laravel translations using Gemini AI.
Installs: 151
Dependents: 0
Suggesters: 0
Security: 0
Stars: 49
Watchers: 0
Forks: 0
Open Issues: 1
Type:laravel-package
Requires
- php: ^8.1
- google-gemini-php/laravel: ^2.0
- laravel/framework: ^10.0 || ^11.0 || ^12.0
- spatie/fork: ^1.2
README
An interactive Artisan command that scans your Laravel project for translation keys, translates them using Google's Gemini AI, and generates the necessary language files.
🚀 Key Features
- Interactive & Cross-Platform: Works on all operating systems with robust fallback
- AI-Powered Translation: Uses Gemini AI for high-quality translations
- Flexible Concurrency: Fork driver for Linux/macOS, sync driver for Windows
- Smart Key Detection: Scans Blade, PHP, Vue, JS, and TypeScript files
- Intelligent Processing: Ignores
route()
andconfig()
helpers
📋 Requirements
- PHP 8.1 or higher
- Laravel 10.0 or higher
- Google Gemini API key
pcntl
extension (for fork driver on Linux/macOS)
⚡ Quick Start
1. Installation
composer require jayesh/laravel-gemini-translator php artisan gemini:install
2. Configuration
Add to your .env
:
GEMINI_API_KEY="YOUR_GEMINI_API_KEY" GEMINI_REQUEST_TIMEOUT=600
Get your API key from Google AI Studio.
3. Usage
# Linux/macOS (fastest) php artisan translations:extract-and-generate --driver=fork # Windows (stable) php artisan translations:extract-and-generate --driver=sync # Basic usage php artisan translations:extract-and-generate
📖 Documentation
For detailed documentation, step-by-step guides, and advanced usage examples, visit our comprehensive documentation:
🔧 Common Options
# Custom languages php artisan translations:extract-and-generate --langs=en,es,fr,de # Skip existing translations php artisan translations:extract-and-generate --skip-existing # Custom chunk size for API requests php artisan translations:extract-and-generate --chunk-size=50 # Get help php artisan help translations:extract-and-generate
🏗️ File Structure
lang/
├── en/messages.php # Grouped keys (messages.*)
├── es/messages.php
├── fr/messages.php
├── en.json # Ungrouped keys
├── es.json
└── fr.json
🛠️ Supported Files & Functions
- Files:
.blade.php
,.php
,.vue
,.js
,.jsx
,.ts
,.tsx
- Functions:
__()
,trans()
,@lang()
,$t()
,i18n.t()
🐛 Issues & Support
- Rate Limits: Free tier has 30 RPM / 1,500 daily requests
- Performance: Use
--driver=fork
on Linux/macOS for best performance - Help: Run
php artisan help translations:extract-and-generate
📜 License
The MIT License (MIT). Please see License File for more information.
⭐ Star this repo if you find it helpful! | 🐛 Report issues on GitHub | 📖 Read full docs at GitHub Pages