jayesh/laravel-gemini-translator
Interactive Artisan command to scan Laravel projects for translation keys, translate them via Google Gemini AI, and generate language files. Supports Blade/PHP/JS/Vue/TS, concurrency, safe atomic writes, and Laravel Modules integration with skip/refresh modes.
declare(strict_types=1) to all PHP files for type safetyLocaleHelper and TextHelper utilitiesCommandRegistration, ServiceProvider, ScannerService, and FileSystemServiceempty() with explicit array/string comparisons (=== [], !== [])in_array(): Added true parameter for strict type checking(int) casts for chunk-size, retry-delay, and concurrency optionsALL_FILES_KEY, ALL_TARGETS_KEY, FILE_KEY_SEPARATOR)usleep() calls to use int instead of floatlang/{locale}) during JSON-only runs.auth.php, pagination.php, passwords.php, validation.php) when only JSON File (*.json) groups are selected.en.json, hi.json, etc.) without forcing PHP file creation.buildTranslationTasks() and staticTranslateKeysWithGemini()config/gemini.php type casting requirement--source option in favor of interactive target selection--no-advanced pattern detection option--dry-run is usedNew Operational Modes
--refresh flag: Re-translate only existing keys from language directories; do NOT generate translations for new/missing keys--dry-run flag: Run full extraction + mapping but show what files would be modified without writing anything--concurrency=N option: Configure number of concurrent processes when using fork driver (defaults to 15)Enhanced Locale & Translation Quality
LocaleHelper utility class with locale canonicalization, script type detection, and humanization ruleslooksMachineKey() detection with comprehensive pattern matching for PascalCase, snake_case, kebab-case, and dot.notationlooksMachineKey() with fast-path checks for common patterns combined with robust regex validationFramework Integration
New Extractor Features
:v-t, :x-text, v-bind:v-t, v-bind:x-text)/s (PCRE_DOTALL) modifierx-text="__('messages.hello')")AI Translation Improvements
withSystemInstruction() from Gemini PHP SDK v2.0Command Signature
--source option--no-advanced option--langs to clarify English is used as sourceTranslation Flow
--refresh and --skip-existing togetherLocaleHelper::canonicalize()File Writing
array() to [] in generated translation filesConcurrency Handling
--concurrency optionError Handling
Critical Security & Safety
Translation Logic
Module Support
Regex Extraction
/s modifierUser Interface & Selection
Memory Optimization
$sourceTextMap to each closureConcurrency Improvements
--source option (now unused, was for deprecated interactive scanning)--no-advanced option (advanced pattern detection removed as it caused false positives)--refresh and --dry-run modes enables safer integration into deployment pipelinesHow can I help you explore Laravel packages today?