Skip to content

Commit

Permalink
Complete the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Mar 5, 2020
1 parent be3a7dc commit 0cac4af
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
61 changes: 28 additions & 33 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,40 @@
2. [Configuration](2-Configuration.md)
3. [Usage](3-Usage.md)
4. [FAQ](4-FAQ.md)

## Server Requirements

The Localization package has a few system requirements:

- PHP >= 7.0

##### Optional

PHP extensions:

* **ext_intl :** Needed to use the `Locale` class. (http://php.net/manual/en/class.locale.php)

## Version Compatibility

| Localization | Laravel |
|:---------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
| ![Localization v0.x][localization_0_x] | ![Laravel v5.0][laravel_5_0] ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |
| ![Localization v1.x][localization_1_x] | ![Laravel v5.4][laravel_5_4] |
| ![Localization v2.x][localization_2_x] | ![Laravel v5.5][laravel_5_5] |
| ![Localization v3.x][localization_3_x] | ![Laravel v5.6][laravel_5_6] |
| ![Localization v4.x][localization_4_x] | ![Laravel v5.7][laravel_5_7] |
| ![Localization v7.x][localization_7_x] | ![Laravel v7.*][laravel_7_x] |
| ![Localization v6.x][localization_6_x] | ![Laravel v6.*][laravel_6_x] |
| ![Localization v5.x][localization_5_x] | ![Laravel v5.8][laravel_5_8] |
| ![Localization v6.x][localization_6_x] | ![Laravel v6.0][laravel_6_0] |
| ![Localization v4.x][localization_4_x] | ![Laravel v5.7][laravel_5_7] |
| ![Localization v3.x][localization_3_x] | ![Laravel v5.6][laravel_5_6] |
| ![Localization v2.x][localization_2_x] | ![Laravel v5.5][laravel_5_5] |
| ![Localization v1.x][localization_1_x] | ![Laravel v5.4][laravel_5_4] |
| ![Localization v0.x][localization_0_x] | ![Laravel v5.0][laravel_5_0] ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |

[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_7_x]: https://img.shields.io/badge/v7.x-supported-brightgreen.svg?style=flat-square "Laravel v7.*"
[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.*"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
[laravel_6_0]: https://img.shields.io/badge/v6.0-supported-brightgreen.svg?style=flat-square "Laravel v6.0"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"

[localization_0_x]: https://img.shields.io/badge/version-0.*-blue.svg?style=flat-square "Localization v0.*"
[localization_1_x]: https://img.shields.io/badge/version-1.*-blue.svg?style=flat-square "Localization v1.*"
[localization_2_x]: https://img.shields.io/badge/version-2.*-blue.svg?style=flat-square "Localization v2.*"
[localization_3_x]: https://img.shields.io/badge/version-3.*-blue.svg?style=flat-square "Localization v3.*"
[localization_4_x]: https://img.shields.io/badge/version-4.*-blue.svg?style=flat-square "Localization v4.*"
[localization_5_x]: https://img.shields.io/badge/version-5.*-blue.svg?style=flat-square "Localization v5.*"
[localization_7_x]: https://img.shields.io/badge/version-7.*-blue.svg?style=flat-square "Localization v7.*"
[localization_6_x]: https://img.shields.io/badge/version-6.*-blue.svg?style=flat-square "Localization v6.*"
[localization_5_x]: https://img.shields.io/badge/version-5.*-blue.svg?style=flat-square "Localization v5.*"
[localization_4_x]: https://img.shields.io/badge/version-4.*-blue.svg?style=flat-square "Localization v4.*"
[localization_3_x]: https://img.shields.io/badge/version-3.*-blue.svg?style=flat-square "Localization v3.*"
[localization_2_x]: https://img.shields.io/badge/version-2.*-blue.svg?style=flat-square "Localization v2.*"
[localization_1_x]: https://img.shields.io/badge/version-1.*-blue.svg?style=flat-square "Localization v1.*"
[localization_0_x]: https://img.shields.io/badge/version-0.*-blue.svg?style=flat-square "Localization v0.*"

## Composer

Expand All @@ -58,6 +49,10 @@ You can install this package via [Composer](http://getcomposer.org/) by running
composer require arcanedev/localization
```

PHP extensions:

* **ext_intl :** Needed to use the `Locale` class. (http://php.net/manual/en/class.locale.php)

## Laravel

### Setup
Expand Down
23 changes: 14 additions & 9 deletions src/Providers/RoutingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

namespace Arcanedev\Localization\Providers;

use Arcanedev\Localization\Middleware;
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
use Arcanedev\Localization\Middleware\{
LocaleCookieRedirect, LocaleSessionRedirect, LocalizationRedirect, LocalizationRoutes, TranslationRedirect
};
use Arcanedev\Localization\Routing\Router;
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;

/**
* Class RoutingServiceProvider
Expand All @@ -29,11 +31,11 @@ class RoutingServiceProvider extends ServiceProvider
* @var array
*/
protected $routeMiddleware = [
'localization-session-redirect' => Middleware\LocaleSessionRedirect::class,
'localization-cookie-redirect' => Middleware\LocaleCookieRedirect::class,
'localization-redirect' => Middleware\LocalizationRedirect::class,
'localized-routes' => Middleware\LocalizationRoutes::class,
'translation-redirect' => Middleware\TranslationRedirect::class,
'localization-session-redirect' => LocaleSessionRedirect::class,
'localization-cookie-redirect' => LocaleCookieRedirect::class,
'localization-redirect' => LocalizationRedirect::class,
'localized-routes' => LocalizationRoutes::class,
'translation-redirect' => TranslationRedirect::class,
];

/* -----------------------------------------------------------------
Expand All @@ -46,10 +48,13 @@ class RoutingServiceProvider extends ServiceProvider
*/
public function register(): void
{
$this->app['router']->mixin(new Router);
/** @var \Illuminate\Routing\Router $router */
$router = $this->app['router'];

$router->mixin(new Router);

foreach ($this->routeMiddleware as $name => $class) {
$this->aliasMiddleware($name, $class);
$router->aliasMiddleware($name, $class);
}
}
}

0 comments on commit 0cac4af

Please sign in to comment.