bramalho/laravel-locale

Laravel Locale Package

v1.0.0 2019-02-16 11:56 UTC

This package is auto-updated.

Last update: 2024-05-16 23:45:36 UTC


README

Latest Stable Version Total Downloads License

Laravel Locale is a package that provide locale switcher for you application.

Installation

Install the package

composer require bramalho/laravel-locale

Add the service provider in config/app.php

BRamalho\LaravelLocale\LaravelLocaleServiceProvider::class,

Publish the configs

php artisan vendor:publish --provider 'BRamalho\LaravelLocale\LaravelLocaleServiceProvider'

Register the Middleware in app\Http\Kernel.php

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Bramalho\LaravelLocale\Http\Middleware\Locale;

class Kernel extends HttpKernel
{
    // ...

    protected $middleware = [
        \Illuminate\Session\Middleware\StartSession::class,
        Locale::class
    ];
}

Usage

<form method="POST" action="{{ route('locale') }}">
    @csrf
    <input type="text" name="locale" value="pt">
    <button type="submit">Submit</button>
</form>

License

The Laravel Locale is open-sourced software licensed under the MIT license.