laravel-lang/status-generator
Dev-only Laravel Lang tool to create missing locales and download/copy translation files from Laravel, framework, Jetstream and more. Includes CLI commands for generating locale stubs, fetching zips by version, and copying lang paths with optional key lookup.
resources/lang), reducing architectural friction.lang create, lang status, lang sync) are self-contained, avoiding invasive modifications to core application logic. Ideal for dev-focused or CI/CD-driven workflows.Console and Filesystem components, ensuring compatibility with Laravel’s dependency stack. Backward-compatible fallbacks (e.g., addCommand method) mitigate risks for older Symfony versions.__(), trans(), and trans_choice() calls, enabling automated key synchronization. Supports ternary operators and dynamic keys, though edge cases (e.g., complex string interpolation) may require manual review.--dev), avoiding runtime overhead. Commands are namespaced under vendor/bin/lang, preventing namespace collisions.register() in StatusGeneratorServiceProvider, requiring minimal bootstrap logic. No database migrations or model changes needed.- run: vendor/bin/lang sync --locale=es --locale=fr
| Risk Area | Severity | Mitigation |
|---|---|---|
| Key Detection Accuracy | Medium | Test edge cases (e.g., trans('key.{variable}')) in CI. Use --only-copy for fallback. |
| Symfony Version Conflicts | Low | Package includes backward-compatible fallbacks (e.g., addCommand method). |
| Google Translate API | Medium | Requires credentials; provide manual translation as alternative. |
| Locale File Corruption | Low | Package validates JSON/YAML structure before writing. |
| Performance at Scale | Low | Commands are optimized for 100+ locales; benchmark with laravel-debugbar. |
lang translate (Google API) is viable.lang status for all locales) or sequentially to avoid resource contention?trans('user.welcome', ['name' => $user->name])) handled? Manual review may be needed.9.x) is recommended.lang translate fails (API limits), what’s the backup? Manual translation or a localized placeholder system?lang status --strict) can enforce thresholds.composer require laravel-lang/status-generator --dev.php artisan vendor:publish --provider="LaravelLang\StatusGenerator\StatusGeneratorServiceProvider".vendor/bin/lang or PHPStorm’s "Run Commands" feature.lang create --locale=es_ES).| Phase | Action | Tools/Commands |
|---|---|---|
| Assessment | Audit existing locales (resources/lang). Run lang status to identify gaps. |
vendor/bin/lang status |
| Setup | Install package and configure Google API (if using lang translate). |
composer require ..., .env setup |
| Backfill | Download upstream translations (e.g., Laravel Framework 12.x). | vendor/bin/lang download --url=... |
| Sync | Sync keys between en and target locales. |
vendor/bin/lang sync --locale=es |
| Automate | Integrate into CI (e.g., GitHub Actions) to run lang sync on PRs. |
.github/workflows/translations.yml |
| Maintenance | Schedule weekly lang status checks in CI to monitor translation drift. |
vendor/bin/lang status --format=json |
__() or trans(), key detection may fail. Test with lang sync --dry-run.t()) if they alias Laravel’s trans().@lang) or JavaScript translation keys.resources/lang). For spatie/laravel-translation-manager, use --only-copy mode.lang sync to update keys before feature development.lang status to generate reports for translators.lang download → lang sync → lang status (fail build if translation coverage < 90%).lang sync for each locale in separate jobs (e.g., es, fr, de).laravel-lang/status-generator annually or when breaking changes are introduced.lang create may evolve (e.g., --force flag). Track via changelog.--verbose to commands for debugging (e.g., lang sync -vvv)..env (e.g., GOOGLE_TRANSLATE_API_KEY)..gitignore-like patterns in config/lang.php (if published).lang sync --dry-run to debug mismatches.storage/ and resources/lang/ are writable.lang translate.laravel-lang, php-translations.trans_choice support).lang status output formatting).laravel-debugbar to profile lang sync.--only-copy for locales with no key changes.lang sync in parallel for non-critical locales (e.g., es, pt).jobs:
sync-es:
run: vendor/bin/lang sync --locale=es
sync-fr:
run: vendor/bin/lang sync --locale=fr
lang download for major releases (e.g., Laravel 13How can I help you explore Laravel packages today?