sbkinfo / languable
Languages for laravel
v1.0.4
2018-02-19 14:56 UTC
This package is not auto-updated.
Last update: 2024-11-10 05:40:37 UTC
README
Languages package for laravel framework.
How to install
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; }
Example
public function __construct(){ $translate = $this->translate(); }
Settings
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