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

Translations Tests Laravel Package

craue/translations-tests

Shared test utilities for Symfony translation files. Provides a base YamlTranslationsTest to validate YAML translations across your project. Configure default locale and translation file paths, then run in your test suite to catch missing keys and locale issues early.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Localization & i18n Roadmap: While this package is Symfony-specific, it inspires a Laravel-native solution to automate translation validation, reducing manual QA effort for multilingual features (e.g., e-commerce, SaaS platforms). Aligns with roadmap items like:
    • "Reduce translation bugs by 50% via automated testing" (via custom Laravel assertions).
    • "Standardize i18n testing across teams" (by providing a reusable test template).
  • Quality Assurance (QA) Automation:
    • Build vs. Buy: Avoids reinventing translation validation from scratch. Instead of custom scripts, leverage a proven pattern (Symfony’s approach) adapted for Laravel.
    • CI/CD Integration: Enables pre-commit hooks or GitHub Actions to block broken translations early (e.g., missing keys, syntax errors).
  • Developer Experience (DX):
    • Onboarding: New devs can instantly validate translations without deep knowledge of Laravel’s internals.
    • Consistency: Enforces uniform translation file structure (e.g., required keys, locale coverage).
  • Cost Efficiency:
    • Low-Cost Alternative: A Laravel-adapted version could be built in <1 week (vs. months of custom tooling).
    • Maintenance Savings: Reuses Laravel’s testing ecosystem (Pest/PHPUnit) instead of Symfony dependencies.

When to Consider This Package

  • Adopt if:

    • Your Laravel project heavily relies on translations (e.g., 10+ locales, frequent updates).
    • You lack automated translation validation and currently rely on manual reviews or ad-hoc scripts.
    • Your team uses PHPUnit/Pest and wants to standardize testing across modules (e.g., resources/lang/).
    • You’re willing to fork and adapt the package (or build a Laravel-native equivalent) to avoid Symfony dependencies.
    • Localization is a critical feature (e.g., global SaaS, multilingual CMS) where bugs are costly.
  • Look Elsewhere if:

    • Your translations are static or rarely updated (manual checks suffice).
    • You use non-standard translation formats (e.g., XLIFF, PO files) or database-backed translations.
    • Your team prefers dedicated localization tools (e.g., Lokalise, Crowdin) for validation.
    • You cannot maintain Symfony dependencies (e.g., symfony/translation conflicts with Laravel’s system).
    • Existing Laravel tools (e.g., spatie/laravel-translation-loader, custom Pest assertions) already meet your needs.

How to Pitch It (Stakeholders)

For Executives: "We can automate 90% of translation validation in our Laravel app by adapting an open-source Symfony tool—saving 10+ hours/week in manual QA and reducing localization bugs by 40%. For a one-time investment of <1 week, this ensures every language file is error-free before release, critical for our [global market/enterprise clients]. The package is lightweight, and we’ll open-source our Laravel version to give back to the community."

For Engineering: *"This Symfony package solves a core problem: validating translation files for missing keys, syntax errors, and locale consistency. Here’s how we’d use it in Laravel:

  • Fork the package and rewrite the file scanner to work with resources/lang/ (JSON/YAML) instead of Symfony’s structure.
  • Replace Symfony’s Translation component with Laravel’s trans() helper for assertions.
  • Integrate with Pest/PHPUnit for seamless testing (example below). Tradeoffs:
  • Effort: 3–5 days to adapt (vs. building from scratch).
  • Risk: Minimal—we’re not using Symfony, just borrowing the validation logic.
  • Alternative: We could write custom tests, but this gives us proven, battle-tested code to start from.

Example Test Class (Proposed Laravel Adaptation):

// tests/TranslationTest.php
use Illuminate\Support\Facades\File;
use Pest\TestCase;

class TranslationTest extends TestCase {
    use \Craue\TranslationsTests\Traits\YamlTranslationValidator; // Hypothetical adapted trait

    protected function defineTranslationFiles(): array {
        return File::allFiles(app()->langPath())
            ->map(fn ($file) => $file->getPathname())
            ->toArray();
    }

    protected function defineDefaultLocale(): string {
        return config('app.locale');
    }
}

Why this works: We keep the same validation rules (e.g., required keys, no duplicate entries) but apply them to Laravel’s file structure."*

For Design/UX Teams: "This tool ensures every language string is accounted for—no more ‘missing translation’ errors in production. For example, it’ll flag if a key like auth.login.button is missing in French before we ship. This directly impacts user experience for non-English speakers."

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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle