vwinck-dev / laravel-translator
Translation files and localization utilities for Laravel.
Requires
- php: ^8.2
- illuminate/support: ^12.0
- monolog/monolog: ^3.10
Requires (Dev)
- fakerphp/faker: ^1.24.1
- friendsofphp/php-cs-fixer: ^3.95.1
- mockery/mockery: ^1.6.12
- orchestra/testbench: ^10.11.0
- phpstan/phpstan: ^2.1.54
- phpunit/phpunit: ^11.5.55
This package is auto-updated.
Last update: 2026-05-08 19:53:23 UTC
README
Translation files and localization utilities for Laravel - publish, manage and extend your app's translations with a single Artisan command.
Features
- Auto-discovery - zero configuration, works out of the box with Laravel's package system
- Artisan integration - publish and update translations via
lang:update - JSON-based - simple, human-readable translation files
- Multi-locale - grow your supported languages incrementally
- CI/CD ready - version-controlled translations that fit neatly into automated pipelines
Requirements
- PHP 8.1+
- Laravel ^10.x
Installation
composer require vwinck-dev/laravel-translator
The package registers itself automatically via Laravel's auto-discovery. No manual provider or alias registration needed.
Publishing Translations
To publish the translation files to your application's lang/ directory, run:
php artisan lang:update
Alternatively, use the standard Artisan vendor publish command:
php artisan vendor:publish --tag=translations
Available Locales
| Locale | Language | Status |
|---|---|---|
en |
English | ✅ |
pt_BR |
Portuguese (Brazil) | ✅ |
Want to add a new locale? See Contributing.
Project Structure
lang/
├── en.json # English (base)
└── pt_BR.json # Portuguese (Brazil)
Each file is a flat JSON map of the original string to its translation - compatible with Laravel's __() and trans() helpers out of the box.
Usage
Use Laravel's built-in translation helpers anywhere in your application:
// Blade {{ __('Attach files by dragging & dropping, selecting or pasting them.') }} // PHP __('Attach files by dragging & dropping, selecting or pasting them.');
The corresponding pt_BR.json entry:
{
"Attach files by dragging & dropping, selecting or pasting them.": "Anexe arquivos arrastando, selecionando ou colando."
}
Roadmap
- Missing translation detection
- Translation diff command
- Vendor package translation support
- Remote synchronization
- Automatic merge support
- Per-locale installer commands
Contributing
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feat/your-locale - Commit your changes:
git commit -m 'feat: add fr locale' - Push and open a Pull Request
Please follow the existing file naming conventions and ensure your JSON is valid before submitting.
License
Distributed under the MIT License. © vwinck-dev