Languages package for laravel framework.
Run this command in terminal
composer require "sbkinfo/languable"
Include ServiceProvider in config/app.php
'providers' => array(
SBKInfo\Languages\Provider::class,
)
Use Languable in your controller
class HomeController extends Controller{
use SBKInfo\Languages\Languable;
}
public function __construct(){
$translate = $this->translate();
}
If you want to use other translate language file (resources/lang) you need pass to translate method path to your custom file, default file path has name as name Controller which was called in translate method
public function __construct(){
$translate = $this->translate('your-path');
}
Created file will be in app/Languages folder.
In order to create Language Class file, you need execute next command
php artisan make:language Language
If you want to create translate file, you need execute command with --lang option
php artisan make:language Language --lang=transfile