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.
Adopt if:
resources/lang/).Look Elsewhere if:
symfony/translation conflicts with Laravel’s system).spatie/laravel-translation-loader, custom Pest assertions) already meet your needs.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:
resources/lang/ (JSON/YAML) instead of Symfony’s structure.Translation component with Laravel’s trans() helper for assertions.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."
How can I help you explore Laravel packages today?