You should be able to use View Composer to enter your translations globally into all kinds of applications. The steps you must follow are as follows.
- Creating a composer of the performance
- Register Presentation Composer to Service Provider
- .
, App\Http\ViewComposers ( )
class TranslationsComposer
{
protected $translations;
public function __construct()
{
$this->translations = [
'brand' => trans('global.brand'),
'my' => trans('global.my'),
];
}
public function compose(View $view)
{
$view->with('translations', $this->translations);
}
}
, , .
-
namespace App\Http\ViewComposers;
use Illuminate\Contracts\View\View;
use Illuminate\Users\Repository as UserRepository;
class ComposerServiceProvider extends ServiceProvider
{
public function boot()
{
view()->composer(
'*','App\Http\ViewComposers\TranslationsComposer'
);
}
public function register()
{
}
}
{{translations.brand}} .
Laravel
https://laravel.com/docs/5.1/views