pinfort / laravel-lang-selector
Create smart multi-language website by laravel
v0.0.1
2018-05-08 07:54 UTC
Requires
- php: >=5.3.0
- illuminate/support: >=4.0
- illuminate/view: >=4.0
This package is auto-updated.
Last update: 2025-03-10 15:40:53 UTC
README
Create smart multi-language website by laravel
Basic Usage
Installation
composer require pinfort/laravel-lang-selector
Attention: Perhaps it is necessary to change the minimum stability of the composer...
Publish files
php artisan vendor:publish
You will find three new files.
- public/vendor/LangSelector/language.css
- It is required.
- config/language.php
- You will edit this file.
- resources/views/vendor/LaravelTopNav/lang_menu.blade.php
- This file is main view of menu.
- In basic, you have no need to edit this file.
Edit config
Edit config/language.php whatever you need. Read comments in the file.
Enable library
Add style sheet link to your view. near the line 14
in resources/views/layouts/app.blade.php(created by make:auth command)
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
+<link href="{{ asset('vendor/LangSelector/language.css') }}" rel="stylesheet">
Add following code in your view.
in resources/views/layouts/app.blade.php(created by make:auth command)
near the line 66
</li>
@endguest
+ @include('LaravelLangSelector::lang_menu')
</ul>
Add middleware to your kernel
in App\Http\Kernel.php near the line 38
protected $middlewareGroups = [
'web' => [
......
+ \Pinfort\LaravelLangSelector\Middleware\LangSelector::class,
],
......
];