Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Localizer Laravel Package

syriable/laravel-localizer

Syriable Localizer is a modern extraction engine for Laravel 13 that scans Blade, PHP, Vue, JS/TS, Livewire and Inertia files to discover and normalize translatable strings, returning typed immutable DTOs via a stable, contracts-driven API.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Strengths:

    • Multi-framework support: Aligns with modern Laravel stacks (Blade, Vue/JS/TS, Livewire, Inertia) and reduces fragmentation in localization workflows.
    • Extraction-first approach: Focuses on discovery (not runtime translation), which is critical for static analysis, CI/CD integration, and developer tooling (e.g., IDE plugins).
    • Normalization: Standardizes string formats (e.g., handling interpolation, pluralization) to improve translation consistency.
    • Laravel 13 compatibility: Leverages Laravel’s service provider/console command architecture, minimizing invasive changes.
  • Fit Risks:

    • Overlap with existing tools: If the team already uses laravel-lang or php-gettext, evaluate redundancy in extraction vs. runtime translation.
    • False positives/negatives: Custom string patterns (e.g., dynamic keys in JS) may require configuration tuning.
    • Livewire/Inertia specificity: If the app heavily uses these, validate coverage for edge cases (e.g., Alpine.js mixed with Livewire).

Integration Feasibility

  • Low-code integration:
    • Single Artisan command (localizer:extract) or CLI tool for batch processing.
    • Configurable via .localizer.php (e.g., ignore paths, custom regex for extraction).
  • Dependencies:
    • Requires PHP 8.2+ (Laravel 13 baseline).
    • No heavyweight dependencies (e.g., no Symfony components beyond Laravel’s core).
  • Testing:
    • CI-ready (GitHub Actions for tests, PHPStan, and code style).
    • Missing: End-to-end tests for all supported frameworks (Vue/JS/TS coverage may need validation).

Technical Risk

Risk Area Severity Mitigation Strategy
Extraction accuracy High Pilot on a subset of files; compare outputs with manual extraction.
Performance Medium Benchmark on large codebases (e.g., 10K+ files).
Framework drift Medium Monitor for breaking changes in Livewire/Inertia/Vue 3+.
IDE/tooling gaps Low Supplement with VSCode/Laravel IDE Helpers for real-time hints.

Key Questions

  1. Current workflow:
    • How are strings currently localized? (Manual? xgettext? Other tools?)
    • What’s the pain point (e.g., missed strings, runtime errors, translation delays)?
  2. Scope:
    • Should this replace all extraction or augment existing pipelines?
    • Are there non-Laravel files (e.g., raw JS, Python) that need exclusion?
  3. CI/CD:
    • Can this run in CI to gate PRs with missing translations (e.g., fail if new strings are unextracted)?
  4. Maintenance:
    • Who will own configuration updates (e.g., adding new file patterns)?
  5. Runtime impact:
    • Does the package modify how translations are loaded at runtime? (Unlikely, but confirm.)

Integration Approach

Stack Fit

  • Native Laravel integration:
    • Registers as a service provider and Artisan command, fitting Laravel’s ecosystem.
    • No framework conflicts: Designed for Laravel 13+; avoids Symfony/Doctrine dependencies.
  • Multi-language support:
    • Handles PHP, Blade, JS/TS, and templating languages (Livewire/Inertia) in a single pass.
    • Edge case: TypeScript decorators or JSX may need custom config.
  • Tooling compatibility:
    • Outputs PO/MO files (compatible with gettext, laravel-lang, or custom pipelines).
    • Can integrate with:
      • Crowdin/Lokalise APIs for translation management.
      • Laravel Scout for fuzzy matching of similar strings.

Migration Path

  1. Pilot Phase:
    • Install in a dev environment: composer require syriable/laravel-localizer.
    • Run php artisan localizer:extract on a single module (e.g., /resources/views/auth).
    • Compare output with existing .json/.php translation files for accuracy.
  2. Configuration:
    • Update .localizer.php to:
      • Ignore vendor/ or test/ directories.
      • Add custom regex for dynamic keys (e.g., {{ $user->name }} vs. {{ __('key') }}).
  3. CI Integration:
    • Add to CI workflow:
      - name: Extract translations
        run: php artisan localizer:extract --output=lang/source
      - name: Validate new strings
        run: git diff --exit-code lang/source || (echo "New strings found!" && exit 1)
      
  4. Gradual Rollout:
    • Phase by file type (e.g., Blade → JS → Livewire).
    • Train devs to use {{ __('key') }} consistently (or configure to extract dynamic strings).

Compatibility

  • Laravel:
    • Tested on Laravel 13; confirm no conflicts with:
      • Custom Blade directives.
      • Livewire 3.x (if using).
  • Frontend:
    • Vue 3/Inertia: Validate extraction of i18n.t() and template literals.
    • JavaScript: Ensure no false positives in dynamic console.log or API responses.
  • Existing translations:
    • Output format should match current (e.g., JSON arrays vs. PO files). Use --format flag if needed.

Sequencing

  1. Pre-requisites:
    • Laravel 13+ with PHP 8.2+.
    • Existing translation files (to compare against).
  2. Core Integration:
    • Install package → Configure → Run extraction.
  3. Validation:
    • Manual review of extracted strings.
    • Automated checks in CI (e.g., "no untranslated strings in PR").
  4. Optimization:
    • Tune .localizer.php for false positives/negatives.
    • Integrate with translation platforms (e.g., Crowdin webhooks).

Operational Impact

Maintenance

  • Configuration Drift:
    • Risk: As the codebase evolves, new string patterns may emerge (e.g., new JS libraries).
    • Mitigation:
      • Document .localizer.php rules in the team’s style guide.
      • Schedule quarterly reviews to update ignored paths/regex.
  • Dependency Updates:
    • Monitor for Laravel 14+ compatibility (if upgrading).
    • Watch for breaking changes in Livewire/Inertia/Vue 3+.
  • Translation File Sync:
    • Challenge: Merging extracted strings with existing .json/.php files.
    • Solution:
      • Use a script to diff and merge (e.g., laravel-lang’s merge command).
      • Or adopt a single-source approach (e.g., only PO/MO files).

Support

  • Developer Onboarding:
    • Pros:
      • Reduces "where do I add this string?" questions.
      • IDE hints (if paired with Laravel IDE Helpers) improve adoption.
    • Cons:
      • Devs may resist if extraction is too aggressive (e.g., logging statements).
    • Training:
      • Add a section to the dev handbook on:
        • How to mark strings for extraction (e.g., {{ __('key') }} vs. dynamic).
        • How to ignore false positives in .localizer.php.
  • Support Channels:
    • Limited community: 0 stars/dependents → rely on GitHub issues or Syriable’s support.
    • Workaround: Fork and extend if critical bugs arise (MIT license allows this).

Scaling

  • Performance:
    • Small/Medium Apps: Near-instant (seconds for 1K files).
    • Large Apps:
      • Test with 10K+ files; may need to:
        • Parallelize extraction (e.g., split by directory).
        • Cache results (e.g., store extracted strings in DB for CI).
  • Translation Workflow:
    • Bottleneck: Manual review of extracted strings at scale.
    • Solution:
      • Integrate with translation tools (e.g., Crowdin API to auto-create projects).
      • Use fuzzy matching to group similar strings.
  • Multi-repo:
    • If using monorepo, configure to ignore other repos’ files.

Failure Modes

Failure Mode Impact Detection/Recovery
Extraction misses strings Untranslated UI elements. Manual review; add test cases for edge patterns.
False positives Noise in translation files. Configure .localizer.php; train devs.
CI flakiness False "new strings" alerts. Whitelist known dynamic strings in config.
Tooling gaps No IDE support. Supplement with custom snippets/extensions.
Runtime errors Broken translations at runtime. Validate output matches existing keys.

**

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky