- How do I install Laravel Lang Publisher for my Laravel project?
- Run `composer require --dev laravel-lang/publisher` in your project directory. The `--dev` flag ensures it’s only installed in development environments. After installation, publish the translations with `php artisan lang:publish` to sync language packs into your `resources/lang` folder.
- Which Laravel versions does this package support?
- Laravel Lang Publisher is actively maintained for Laravel 10, 11, 12, and 13. It also works with Lumen if you manually configure the `lang_path()`. Check the [documentation](https://laravel-lang.com/packages-publisher.html) for version-specific notes or compatibility issues.
- Can I customize which language packs get published?
- Yes, the package allows fine-grained control. Use the `--lang` flag with `php artisan lang:publish` to specify languages (e.g., `php artisan lang:publish --lang=en,fr`). You can also exclude specific packs or override files by editing the `.env` configuration or creating custom publish scripts.
- What happens if I update Laravel Lang translations and my local files have conflicts?
- The package handles conflicts by preserving your local changes. When you run `php artisan lang:update`, it will merge upstream translations while keeping your custom keys intact. For complex conflicts, manually review the merged files or use the `lang:diff` command (if available) to identify discrepancies before applying updates.
- Is Laravel Lang Publisher safe to use in production?
- No, this package is designed as a **development-only** tool (installed with `--dev`). It only publishes files to `resources/lang/` during development. Production builds should exclude the package, and translations are cached by Laravel’s default system, so there’s no runtime impact.
- How do I handle translations for a multi-module Laravel app?
- The package works seamlessly in modular setups since it operates on the standard `lang/` directory. Use the `--path` flag to specify custom paths if your modules store translations elsewhere. For monorepos, install the package per-module or globally, but ensure `lang_path()` is correctly configured to avoid conflicts.
- Can I use this with third-party translation tools like Crowdin or Lokalise?
- Yes, but plan your workflow carefully. Use Publisher to sync standard Laravel Lang translations (e.g., auth, validation) and manage custom or professional translations separately. Avoid overwriting files managed by Crowdin/Lokalise by excluding their directories from Publisher’s sync or using CI/CD to gate updates.
- How do I test if translations are correctly published?
- Run `php artisan lang:publish --dry-run` to preview changes without modifying files. Test translations in your app using Laravel’s `trans()` helper or the `php artisan lang:test` command (if available). For automated testing, mock the `lang_path()` or use Laravel’s `TranslationServiceProvider` to verify loaded files.
- What if I need to revert to an older version of a language pack?
- Use Git to revert changes to your `resources/lang/` directory. Publisher doesn’t track versions natively, so commit translations before updating. For Laravel Lang-specific rollbacks, check the [Laravel Lang releases](https://github.com/Laravel-Lang/locales/releases) and manually restore files from the corresponding version.
- Are there alternatives to Laravel Lang Publisher for managing translations?
- For Laravel, alternatives include manually copying files from Laravel Lang’s [locales repository](https://github.com/Laravel-Lang/locales) or using packages like `spatie/laravel-translatable` for dynamic translations. However, Publisher is uniquely optimized for Laravel Lang’s ecosystem, offering automated updates, conflict resolution, and CLI integration tailored to Laravel’s workflow.