2017 © Pedro Peláez
 

library laravel-locale

Powerful Localization for Laravel 5

image

mputkowski/laravel-locale

Powerful Localization for Laravel 5

  • Tuesday, June 12, 2018
  • by mputkowski
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Laravel Localization

run-tests StyleCI Codecov Latest Stable Version Total Downloads License, (*1)

Localization for Laravel, (*2)

Installation

L6 L7 L8 L9 L10 L11 L12
v4 ✓ ✓ ✓ ✓ ✗ ✗ ✗
v5 ✗ ✗ ✗ ✓ ✓ ✓ ✓

Add package to composer.json, (*3)

composer require mputkowski/laravel-localization

Publish package's config file, (*4)

php artisan vendor:publish --provider="mputkowski\Localization\ServiceProvider"

Laravel 11 or newer

Append the middleware to the web group in the bootstrap/app.php:, (*5)

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \mputkowski\Localization\Middleware\VerifyLangCookie::class,
    ]);
})

Laravel 10 or older

Include middleware within the web group in middlewareGroups array (app/Http/Kernel.php):, (*6)

'web' => [
    \mputkowski\Localization\Middleware\VerifyLangCookie::class,
],

You don't have to register service provider and alias, this package uses Package Auto-Discovery., (*7)

Configuration

Configuration is stored in config/localization.php file., (*8)

Key Type Default
auto bool true
cookie_name string lang
default_locale string en
Route
enabled bool true
pattern string /lang/{lang}

Auto-detection

If auto is set to true, the app will automatically detect client's language. The lang directory will be compared with the client's Accept-Language header. If header doesn't match with the app's locales, language will be set to default., (*9)

Auto-detected language could be changed by accessing a special route designed for that, or by calling the setLocale method:, (*10)

use mputkowski\Localization\Facades\Localization;

Localization::setLocale('en');

Route

This package also provides routes for quick language change (url: /lang/{lang}, example /lang/en)., (*11)

Contributing

Feel free to create pull requests or open issues, I'll look on them as quick as I can., (*12)

License

This project is open-sourced software licensed under the MIT license., (*13)

MIT License

Copyright (c) 2018 - 2025 Michał Putkowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

The Versions

12/06 2018

dev-master

9999999-dev

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

26/05 2018

v1.4

1.4.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

26/05 2018

dev-analysis-8LY6wo

dev-analysis-8LY6wo

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

13/05 2018

v1.3

1.3.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

10/05 2018

v1.2

1.2.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

21/04 2018

dev-travis-fix

dev-travis-fix

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

12/04 2018

v1.1

1.1.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

11/03 2018

v1.0

1.0.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

05/03 2018

v0.5

0.5.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

23/02 2018

v0.4

0.4.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

08/02 2018

v0.3

0.3.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization laravel-locale laravel locale

02/02 2018

v0.2

0.2.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Putkowski

laravel framework locale localization

26/01 2018

v0.1

0.1.0.0

Powerful Localization for Laravel 5

  Sources   Download

MIT

The Requires

 

by Michal Putkowski

laravel framework locale localization