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 Translations Checker Laravel Package

larswiegers/laravel-translations-checker

Find missing Laravel translations fast. Run php artisan translations:check to compare languages and see what keys are missing and where. Supports custom lang directories plus excluding vendor paths, specific languages, and file extensions for cleaner results.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit:

  • Pros: Aligns perfectly with Laravel’s native translation system (resources/lang), requiring no architectural changes. Supports both PHP and JSON formats, which are standard in Laravel. Zero runtime impact (installed as a dev dependency).
  • Cons: Limited to static translation files; does not analyze dynamically generated keys (e.g., Lang::get($dynamicKey)) or custom translation drivers (e.g., database-backed). Assumes standard Laravel file structure, which may not apply to monorepos or non-standard setups.

Integration feasibility:

  • High. Single Composer command (composer require --dev) with optional CLI flags or config overrides. No API or service integration required—purely a validation tool.
  • Configuration: Minimal setup (e.g., excluded_directories, exclude_languages). Supports both CLI and config-based exclusions, reducing friction for teams with complex translation hierarchies.

Technical risk:

  • Low to moderate. Risks include:
    • False negatives: Misses translations generated at runtime (e.g., via trans('key.'.$dynamicSuffix)). Requires manual review or supplementary tools (e.g., static analysis).
    • Performance: Scaling issues with >10K translation files (untested; depends on filesystem I/O and memory usage).
    • Edge cases: Nested directories or non-standard paths (e.g., app/Translations) may require custom exclusion rules.
  • Mitigation: Validate against a subset of translation files in CI before full adoption. Monitor runtime for false negatives in production.

Key questions:

  1. Dynamic keys: How will the team handle runtime-generated translation keys? Are there patterns (e.g., trans('auth.{{$type}}')) that can be pre-validated?
  2. Scalability: What is the expected size of translation files? Will the tool’s performance degrade in large projects (e.g., >50 languages)?
  3. Custom drivers: Does the project use non-file-based translations (e.g., database, API)? If so, how will completeness be ensured?
  4. CI/CD integration: Should the tool block merges (fail-fast) or report issues (fail-late)? How will false positives be managed?
  5. Localization tools: Does the team use tools like Crowdin or Lokalise? How will this package complement (or conflict with) their workflow?

Integration Approach

Stack fit:

  • Laravel-native: Works out-of-the-box with Laravel’s translation system (v8–12). No dependencies on external services or frameworks.
  • Dev-only: Zero runtime overhead; ideal for development and CI environments.
  • Format support: JSON/PHP files (standard in Laravel). Excludes vendor files by default, reducing noise.

Migration path:

  1. Installation: Add to composer.json as a dev dependency:
    composer require --dev larswiegers/laravel-translations-checker
    
  2. Configuration (optional):
    • Add to config/translation-checker.php (if using config-based exclusions):
      'excluded_directories' => ['lang/vendor', 'custom/path'],
      'exclude_languages' => ['en', 'test'],
      'excluded_file_extensions' => ['php'], // Keep only JSON
      
  3. Testing:
    • Run locally to validate output:
      php artisan translations:check --directory=resources/lang
      
    • Test exclusions (e.g., vendor files, test languages).
  4. CI/CD integration:
    • Add to GitHub Actions (example provided in README) or other CI tools. Example:
      - name: Check translations
        run: php artisan translations:check --excludedDirectories=vendor
      
    • Decide on failure mode: set +e to allow non-critical warnings or strict mode to block merges.

Compatibility:

  • Laravel: 8.0+ (tested up to 12.x). Backward-compatible with PHP 8.0+.
  • File formats: PHP arrays and JSON (no YAML or other formats).
  • Edge cases:
    • Non-standard paths: Use --directory flag or config.
    • Mixed environments: Ensure CI and local environments use identical exclusion rules.
    • Partial translations: Tool reports missing keys but not partial/incomplete translations (e.g., nl: { "key": "partial" }).

Sequencing:

  1. Phase 1: Install and test locally with a subset of languages/files.
  2. Phase 2: Integrate into CI with non-blocking checks (report issues).
  3. Phase 3: Enforce fail-fast in CI for critical paths (e.g., production languages).
  4. Phase 4: Extend exclusions or rules based on false positives/negatives.

Operational Impact

Maintenance:

  • Low effort. Package is MIT-licensed with active maintenance (last release: 2026-07-01). Updates are minimal (e.g., Laravel version compatibility).
  • Dependencies: None in production; dev-only Composer package.
  • Configuration drift: Monitor for changes in translation file structure (e.g., new directories) and update exclusions accordingly.

Support:

  • Troubleshooting: Common issues include:
    • False positives (e.g., keys in excluded directories). Solution: Adjust exclusions.
    • False negatives (dynamic keys). Solution: Document limitations or supplement with manual reviews.
    • Performance lag. Solution: Exclude large or irrelevant directories.
  • Documentation: README and config options are clear, but teams may need internal runbooks for CI integration and exclusion rules.

Scaling:

  • Performance: Untested at scale (>10K files), but filesystem operations are the primary bottleneck. Mitigate by:
    • Excluding non-critical directories (e.g., lang/vendor).
    • Running in parallel (if supported by CI).
    • Caching results for incremental checks (not natively supported; may require custom scripting).
  • Language growth: Adding new languages requires no tool changes—only ensure files exist in the target directory.

Failure modes:

Scenario Impact Mitigation
Missing translations in prod User-facing errors Enforce CI checks; fail-fast for prod languages.
False positives (excluded files) Noise in CI logs Review exclusions; test with sample data.
Dynamic keys not detected Undetected gaps Supplement with manual reviews or static analysis.
CI timeout Broken pipeline Exclude large directories; optimize CI resources.
Configuration errors No output or crashes Validate config syntax; use CLI flags for testing.

Ramp-up:

  • Developer onboarding: <30 minutes to install and run locally. CI integration adds <1 hour.
  • Key training topics:
    • How to interpret output (e.g., missing files vs. missing keys).
    • When to exclude directories/languages (e.g., vendor files, test languages).
    • Handling false positives/negatives.
  • Adoption barriers:
    • Resistance to CI failures (mitigate by starting with non-blocking checks).
    • Dynamic key limitations (document as a known constraint).
    • Non-standard project structures (require upfront configuration review).
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony