Translation Component
Translation Component extends the functionality of Illuminate\Translation
to add support for cascading filesystem replacement for Laravel 4 packages.
Version Compatibility
Laravel | Translation |
---|---|
4.0.x | 2.0.x |
4.1.x | 2.1.x |
4.2.x | 2.2.x |
5.0.x | 3.0.x |
5.1.x | 3.1.x |
5.2.x | [email protected] |
Installation
To install through composer, simply put the following in your composer.json
file:
{
"require": {
"orchestra/translation": "~3.0"
}
}
And then run composer install
from the terminal.
Quick Installation
Above installation can also be simplify by using the following command:
composer require "orchestra/translation=~3.0"
Configuration
Next add the service provider in config/app.php
.
'providers' => [
// ...
# Remove 'Illuminate\Translation\TranslationServiceProvider'
# and add 'Orchestra\Translation\TranslationServiceProvider'
Orchestra\Translation\TranslationServiceProvider::class,
],
Orchestra\Translation\TranslationServiceProvider
should replaceIlluminate\Translation\TranslationServiceProvider
.
Usage
Translation Component make it easier to have redistribute packages language files, instead of relying on resources/lang/en/package/name/title.php
you can now publish it under resources/lang/vendor/name/en/title.php
making it easier to create repository (and publish it under GitHub) for a single packages or extension to handle multiple languages.