- How does Syriable Localizer compare to Laravel’s built-in `__()` function for extraction?
- Syriable Localizer goes beyond `__()` by scanning *all* source files (Blade, Vue, JS/TS, Livewire, Inertia) for translatable strings, even dynamic or untranslated ones. It normalizes formats (e.g., interpolation, pluralization) and outputs structured DTOs for static analysis, while Laravel’s `__()` only handles runtime translation keys.
- Can this package extract strings from JavaScript/TypeScript files in a Laravel + Inertia/Vue app?
- Yes, it supports JS/TS files by default, including Vue SFCs, Inertia components, and raw scripts. For edge cases like dynamic keys or JSX, you’ll need to configure custom regex patterns in `.localizer.php` to avoid false positives/negatives.
- Will this break existing translation workflows (e.g., PO/MO files or laravel-lang)?
- No, it’s extraction-only and outputs PO/MO-compatible files. It integrates with existing pipelines (e.g., Crowdin, Lokalise) and won’t modify runtime translation logic. Test outputs against your current `.json`/`.php` files to validate compatibility.
- How do I run this in CI to block PRs with untranslated strings?
- Add `php artisan localizer:extract --output=lang/source` to your CI, then use a script to compare new strings against your translation files. Example: `git diff --exit-code lang/source || exit 1`. Configure `.localizer.php` to ignore test/vendor paths.
- Does this work with Livewire components that mix PHP and JavaScript?
- Yes, it scans Livewire files for both Blade and JS/TS strings. For complex cases (e.g., Alpine.js + Livewire), ensure your `.localizer.php` includes the correct file patterns. Test with a sample component to validate coverage.
- What Laravel versions and PHP requirements does this support?
- It’s built for Laravel 13+ and requires PHP 8.2+. It avoids Symfony/Doctrine dependencies, relying only on Laravel’s core. For older Laravel versions, check the GitHub issues for backport discussions or fork the package.
- How do I handle false positives (e.g., extracting non-translatable strings like API keys)?
- Use `.localizer.php` to define ignore patterns (e.g., regex for UUIDs, config keys). For dynamic strings (e.g., `{{ $user->name }}`), configure custom extraction rules or use the `--strict` flag to exclude them.
- Can this replace `php-gettext` or `laravel-lang` for runtime translations?
- No, this is *only* for extraction. Use it alongside `laravel-lang` or `gettext` for runtime translation. It outputs PO/MO files compatible with those packages, so you can pipe its results into your existing workflow.
- How do I configure it to ignore specific directories or file types?
- Edit `.localizer.php` to add `ignore_paths` (e.g., `['vendor/*', 'tests/*']`) or `ignore_patterns` (e.g., regex for `.min.js`). Example: `'ignore_paths' => [storage_path('logs/*')]`. Run `php artisan localizer:extract --dry-run` to test.
- Are there performance concerns for large codebases (e.g., 10K+ files)?
- Benchmark with your codebase, but it’s optimized for speed. For CI, cache results or run incrementally (e.g., `localizer:extract --path=resources/views`). If slow, exclude non-critical paths (e.g., `node_modules`) in `.localizer.php`.