laravel-translator maintained by vwinck-dev
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