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.
resources/lang/, trans() helper). Minimal architectural disruption; fits cleanly into existing Laravel monoliths or modular setups.locales, json-fallback).laravel-lang/locales (for locale metadata), laravel-lang/json-fallback (for fallback logic).translation service provider.lang_path() helper, config('app.locale')). For Lumen, requires explicit lang_path() definition (v14.4.0+).events system or custom service providers.lang:publish --force or post-processing scripts.resources/lang/{locale}/auth.php, validation.php, etc.resources/lang/{locale}/messages/{context}.php) with subkey preservation (v16.7.0+)..env (e.g., LANG_PUBLISHER_DEFAULT_LOCALE), enabling dynamic runtime adjustments.| Risk Area | Severity | Mitigation |
|---|---|---|
| Locale Conflict Resolution | Medium | Test with overlapping keys (e.g., auth.password vs. custom password.*). Use --force cautiously. |
| Laravel Version Lock | Low | Package supports v10–13; upgrade paths are explicit (e.g., v15.0.0 dropped v9). |
| Custom File Structures | Medium | Validate against Laravel’s FileManager expectations; avoid non-JSON formats. |
| Performance Overhead | Low | CLI commands are lightweight; no runtime impact post-publish. |
| Dependency Bloat | Low | Dependencies are minimal (~2MB total); no external APIs. |
| Team Adoption | Medium | Requires CLI familiarity; document workflows (e.g., lang:publish --help). |
--force behavior..po, .xlf)? Publisher is JSON-focused.# GitHub Actions
- name: Publish translations
run: php artisan lang:publish --force
if: github.ref == 'refs/heads/main'
events.TranslationServiceProvider, trans() helper, and config('app.locale').laravel-lang/locales for locale metadata (e.g., region codes, scripts).Testing facade (e.g., actingAsLang()).lang_path() definition (v14.4.0+).resources/lang/ structure.lang:publish, lang:update, lang:remove).| Phase | Action | Tools/Commands | Risk |
|---|---|---|---|
| Assessment | Audit existing translations: Are they Laravel-compatible JSON files? | php artisan lang:list (custom script) |
Low |
| Pilot | Publish core files (auth/validation) to a staging branch. | php artisan lang:publish |
Medium (conflict risk) |
| Validation | Test translations in all locales; verify fallback logic. | php artisan lang:update --dry-run |
Low |
| Customization | Override default translations; document customization workflow. | --force flag, post-publish scripts |
Medium |
| CI/CD | Automate publishing in CI (e.g., post-merge to main). |
GitHub Actions/GitLab CI | Low |
| Scaling | Extend to custom content (e.g., API responses, marketing). | Custom file structures, event listeners | Medium |
readonly properties.resources/lang/ structure. Custom paths require lang_path() override.laravel-lang/locales (v2.3+), laravel-lang/json-fallback (v2.0+).phpunit/phpunit (for tests), symfony/console (Laravel core).smart_punctuation option (v14.6.4+).en-US → en) via laravel-lang/locales..env configured with APP_LOCALE.composer require --dev laravel-lang/publisher
php artisan vendor:publish --provider="LaravelLang\Publisher\PublisherServiceProvider"
php artisan vendor:publish --tag="publisher-config"..env (e.g., LANG_PUBLISHER_DEFAULT_LOCALE=de).php artisan lang:publish --force # Overwrite existing files
php artisan lang:update # Merge upstream changes
lang:publish:custom command for non-core files.vendor:publish). Use Git to track changes..env overrides are ephemeralHow can I help you explore Laravel packages today?