2017 © Pedro Peláez
 

library laravel-languages

image

d3jn/laravel-languages

  • Thursday, July 26, 2018
  • by d3jn
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

This package will no longer be maintained. It is very simple and does what it was created for, so I have no plans on supporting it in the future.

Laravel Languages

Very basic package that takes care of handling routing for multilanguage sites. Only basic features with minimum of configuration., (*1)

Getting Started

Prerequisites

This package was developed using Laravel 5.6., (*2)

Installing

Use composer to install this package:, (*3)

composer require d3jn/laravel-languages

Laravel Package Auto-Discovery should handle adding service provider and alias for you automatically or you can manually add those to your providers and aliases list in app.php:, (*4)

'providers' => [
    ...

    D3jn\LaravelLanguages\LanguagesServiceProvider::class,

    ...
],

...

'aliases' => [
    ...

    'Languages' => D3jn\LaravelLanguages\Facades\Languages::class,

    ...
],

Lastly, you should publish it's configuration file:, (*5)

php artisan vendor:publish --provider="D3jn\LaravelLanguages\LanguagesServiceProvider"

Now you can proceed with configuring this package for your needs., (*6)

Configuration

Open config/languages.php. All available configurations are well documented there., (*7)

Usage

Specify callable for properly setting locale in your routes file, for example:, (*8)

Languages::setLocaleCallable(function ($locale) {
    // Example of initializing various packages with locale:
    Carbon::setLocale($locale);
    LaravelGettext::setLocale($locale);
    App::setLocale(LaravelGettext::getLocaleLanguage());
});

Then define route group for your application routes and use Languages::init() as it's prefix and languages middleware:, (*9)

Route::group(
    ['prefix' => Languages::init(), 'middleware' => ['languages']],
    function () {
        Route::get('/', function () {
            return __('hello');
        });

        ...
    }
);

Built With

Authors

  • Serhii Yaniuk - d3jn

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*10)

The Versions

26/07 2018

v1.0.x-dev

1.0.9999999.9999999-dev

  Sources   Download

MIT

The Requires

 

by Serhii Yaniuk

26/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Serhii Yaniuk

26/07 2018

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Serhii Yaniuk