coffreo/js-translation-extractor
Extracts Laravel translation strings used in JavaScript by scanning your frontend source. Helps keep locale files in sync with JS usage and reduces missing-key issues in mixed Blade/Vue/React apps.
trans() and json translation files are backend-centric. This package enables frontend translation extraction, which can then be merged into Laravel’s translation pipelines (e.g., via php artisan translate:extract or custom scripts).laravel-lang or laravel-translation-manager) for full coverage..js, .jsx, .vue, etc.) for __() or $t() translation keys (common in i18n libraries like i18next, Vue I18n).translations/en.json). This can be:
resources/lang/ directory.php-gettext or laravel-translation-manager for unified translation management..gitignored files).git push, pr, or manually? How will conflicts (e.g., missing keys) be handled?resources/lang/ files? Will a custom Artisan command or script be needed?trans() helper, lang files) can consume the extracted JSON/PO output.vue-i18n has built-in extraction tools.react-intl supports message extraction.__('key'), $t('key')).resources/lang/ and validate.composer require coffreo/js-translation-extractor).resources/lang/{locale}.json.php artisan translate:update (if using php-gettext).main.$translate).resources/lang/{locale}.json), but PO files require php-gettext or manual conversion.lang files as the authority).dev dependency to avoid bloating production.TRANSLATION_GUIDE.md with examples and CI error messages.parallel-lint or custom scripts).node_modules or build artifacts.lang/en.json, lang/es.json).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package stops working (abandonware) | Broken extraction pipeline | Fork the repo or switch to a maintained alternative (e.g., custom script). |
| JS i18n syntax changes | Extraction misses new patterns | Regularly audit JS files and update extraction rules. |
| Merge conflicts in translations | Duplicate/missing keys | Enforce CI checks and use a unified translation file. |
| CI pipeline fails on extraction | Blocked PRs | Cache extraction results or run in a separate job. |
How can I help you explore Laravel packages today?