laravel-lang/publisher
Laravel Lang Publisher lets you publish and manage Laravel Lang translation files in your app. Install as a dev dependency and use it to keep localization resources organized and up to date with the Laravel Lang ecosystem.
trans() helper, lang() directory structure, and Artisan CLI. Aligns with Laravel’s service container, configuration system, and event-driven architecture (e.g., translated events).Lang::get()) and service providers.laravel-lang/locales) and environment-specific overrides (.env config), allowing hybrid workflows (e.g., mix of upstream + custom translations).LangPublished) for post-processing (e.g., logging, analytics, or syncing to external systems), enabling observability and auditability.lang_path()), broadening applicability to microservices or API-first Laravel apps.composer require and a single ServiceProvider registration. Minimal boilerplate (e.g., config/lang.php overrides).laravel-lang/locales (for locale data, v2.3+).laravel-lang/json-fallback (for JSON handling, v2.0+)..env variables (e.g., LANG_PUBLISHER_DRIVER) for environment-specific behavior, reducing hardcoded logic.php artisan lang:publish), enabling DevOps-friendly workflows (e.g., CI/CD pipelines).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Laravel Version Lock | Medium | Package supports Laravel 10–13; validate compatibility with your minor version. Use laravel/framework constraints in composer.json. |
| Locale Data Conflicts | High | Risk of overwriting custom translations with upstream updates. Mitigate via: |
- Backup resources/lang/ before updates. |
||
- Use lang:update --dry-run to preview changes. |
||
- Configure ignore patterns in config/lang.php to exclude custom files. |
||
| Performance Overhead | Low | CLI commands are synchronous; no runtime impact unless using trans() heavily. |
Benchmark lang:publish for large projects (>50 languages). |
||
| Custom Key Handling | Medium | Subkeys/arrays may lose translations if not structured as key.subkey. |
Test with nested JSON (e.g., validation.attributes) before production use. |
||
| CI/CD Pipeline Impact | Medium | Commands may fail silently if lang/ directory is missing. Add pre-flight checks. |
Example: if [ ! -d "lang" ]; then mkdir -p lang; fi in CI scripts. |
||
| Dependency Updates | Low | Follow laravel-lang/locales for breaking changes (e.g., v2.3+ requires PHP 8.1+). |
| Lumen-Specific Quirks | Low | Ensure lang_path() is defined in Lumen’s bootstrap/app.php if used. |
LangPublished events)?lang:publish --force)?lang/ or use a separate repo for translations?lang:publish in CI).| Phase | Action | Tools/Commands | Risk |
|---|---|---|---|
| Assessment | Audit existing resources/lang/ structure. |
tree resources/lang/ |
Low |
| Identify custom vs. core Laravel translations. | Compare with vendor/laravel-lang/locales. |
Medium (manual effort) | |
| Pilot | Install in staging with a subset of locales (e.g., en, es). |
composer require laravel-lang/publisher |
Low |
Test lang:publish and lang:update commands. |
php artisan lang:publish |
Medium (conflict risk) | |
| Configuration | Override defaults in config/lang.php (e.g., driver, ignore patterns). |
Edit config file | Low |
| CI/CD Setup | Add lang:update to nightly CI or pre-deploy. |
GitHub Actions workflow | Medium (failure mode) |
| Rollout | Deploy to production with one locale at a time. | Monitor translated events |
High (user-facing impact) |
| Optimization | Automate backup/restore for lang/. |
Custom script + git |
Low |
| Add post-publish hooks (e.g., Slack notifications). | Event listeners | Low |
trans() helper (core functionality).app/Http/Middleware/SetLocale.php).resources/lang/validation.php).resources/lang/auth.php).trans('key', ['var' => $value])) work but may lose structure in nested arrays.laravel-lang/locales).How can I help you explore Laravel packages today?