jayesh/laravel-gemini-translator
An interactive Artisan command and browser Translation Manager that scan Laravel projects for translation keys and generate language files with Gemini AI. Includes lang-pack support, concurrency, four sync modes, and script-fault highlighting. Review AI output before shipping.
Architecture fit. The package is a development-time Artisan command, not a runtime dependency — no middleware, service bindings, or request-path code. Its footprint is a TranslationServiceProvider, a published config file, and console command registration. Internally it separates scanning (ScannerService), filesystem writes (FileSystemService), and locale normalization (LocaleHelper/TextHelper), with declare(strict_types=1), PHPStan level 5, Pint/Rector, and a 37-test/110-assertion Testbench suite in v5. For a 69-star package that is unusually disciplined engineering hygiene and is the strongest signal in this evaluation.
Integration feasibility. Mechanically trivial: composer require --dev, publish config, set GEMINI_API_KEY. Two friction points are documented in the README and are real onboarding blockers:
google-gemini-php/laravel config requires 'request_timeout' => (int) env(...); the uncast form throws a runtime configuration exception. This is a papercut that will burn the first hour of any pilot.--source in favor of interactive target/file-group selection). Non-interactive CI execution is the single most important unknown — if it needs a TTY for file-group selection, the automation story collapses to "run locally."Technical risk.
--source/--no-advanced, PHP 8.2→8.3 bump, strict typing). This is a package that will force upgrade work.pcntl (fork driver) is commonly absent in container images.lang/ directories.Key questions for the maintainer/team.
translations:extract-and-generate run fully headless (--no-interaction) in CI, including file-group selection?--max-retries re-bill on partial failures?laravel-lang/lang publishing the same auth.php/validation.php/passwords.php framework files)?Stack fit. Best fit: a Laravel monolith or nwidart/laravel-modules application with a Blade + Vue mix and a lang/ directory already under version control. Explicit --consolidate-modules support and Vue $t()/i18n.t()/v-t attribute detection make this a genuinely opinionated-good match for that profile. Poor fit: API-only backends with little user-facing copy, or SPAs with translations owned by a separate frontend repo — the scanner would be reading strings it shouldn't own.
Migration path. Treat generated files as reviewable artifacts, never as a black box:
lang/ tree so manual translations can be diffed and restored.--dry-run first to inventory what the scanner thinks the keys are. Compare against reality — false positives (dynamic keys, __($var) concatenations) are expected and are the main quality gate.--skip-existing against a single target locale to prove key extraction before paying for the full locale set.--langs. Treat --refresh as a scheduled, deliberate campaign — never a routine command, since it re-translates and churns every existing string.translation_extraction_log.json and failed_translation_keys.json (written to project root) to .gitignore or an artifacts path.Compatibility.
require-dev and an exact pinned version. This is a build tool; it should never appear in a production composer install --no-dev graph.auth/pagination/passwords/validation files). Pick one owner for those files.pcntl and tokenizer in the build image; default to --driver=sync in CI for determinism, use fork only on developer machines or dedicated runners.en-US → en_US) mutates directory naming — audit existing directory names before the first write.Sequencing.
--dry-run + --skip-existing, diff review by a native speaker.trans_choice strings.--driver=sync, --chunk-size reduced, and a PR opened for human review rather than direct push.--skip-existing on demand when new keys land; quarterly --refresh for quality campaigns on a single locale at a time.Maintenance. This is the dominant cost. One maintainer, no dependents, and a breaking-change-per-minor-major cadence means a deliberate upgrade review roughly each time you touch it. Mitigate by pinning the version and designating an internal owner who re-evaluates on Laravel/PHP upgrades. Because it's dev-only, a broken release cannot take down production — that materially lowers the stakes.
Support. GitHub issues and a GitHub Pages docs site; no vendor, no SLA, no LTS branch. Documentation quality is above average for the star count (troubleshooting, changelog, mode compatibility matrix), which partially compensates. Expect to self-diagnose API failures.
Scaling. Cost and quota scale linearly with keys × locales × retries. The free tier (15 RPM / 1000 requests/day) will not survive a real project; a paid Gemini tier is a prerequisite, not an optimization. Concurrency raises throughput but also multiplies rate-limit exposure and memory; --chunk-size and --concurrency must be tuned together, and the package's automatic chunk reduction for keys >80 chars exists precisely because large validation-attribute keys blow past model limits. GEMINI_REQUEST_TIMEOUT=600 implies long-running jobs — size CI runner timeouts accordingly.
Failure modes to plan for.
--skip-existing is your friend).:name, {0}, %s mangled into unusable strings. The package detects mismatch, but detection ≠ prevention; runtime str_replace errors are the blast radius if a bad string ships.sync in automation.GEMINI_API_KEY in logs or committed .env; enforce secrets management.Ramp-up. A developer can run a first successful extraction in under an hour. Realistic time-to-competence is 2–4 days for one engineer to cover locale canonicalization quirks, module mode, cost modeling, and CI wiring. The blast radius of mistakes is confined to version-controlled language files, which makes the ramp-up forgiving — the main organizational learning is process, not technology: who reviews machine-translated diffs, and which strings are exempt from automation.
Bottom line for a TPM: low-risk, low-cost, moderate-value adoption as a dev-only, pinned, human-reviewed auxiliary tool for UI and validation strings — contingent on confirming headless CI execution and accepting single-maintainer support. It is not a replacement for a translation management system, and it should not be the sole path by which customer-facing copy reaches production.
How can I help you explore Laravel packages today?