Skip to content

Commit dac04b1

Browse files
authored
Remove locale middleware (#341)
1 parent 7e3746a commit dac04b1

File tree

7 files changed

+3
-56
lines changed

7 files changed

+3
-56
lines changed

config/common/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Yiisoft\Router\Route;
88

99
return [
10-
Group::create('/{_language}')
10+
Group::create()
1111
->routes(
1212
Route::get('/')->action([SiteController::class, 'index'])->name('home'),
1313
),

config/web/di/application.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@
2121
'fallbackHandler' => Reference::to(NotFoundHandler::class),
2222
],
2323
],
24-
\Yiisoft\Yii\Middleware\Locale::class => [
25-
'__construct()' => [
26-
'supportedLocales' => $params['locale']['locales'],
27-
'ignoredRequestUrlPatterns' => $params['locale']['ignoredRequests'],
28-
],
29-
],
3024
];

config/web/events.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@
22

33
declare(strict_types=1);
44

5-
use App\EventHandler\SetLocaleEventHandler;
6-
use Yiisoft\Yii\Middleware\Event\SetLocaleEvent;
7-
85
return [
9-
SetLocaleEvent::class => [[SetLocaleEventHandler::class, 'handle']],
106
];

config/web/params.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,11 @@
55
use Yiisoft\ErrorHandler\Middleware\ErrorCatcher;
66
use Yiisoft\Router\Middleware\Router;
77
use Yiisoft\Session\SessionMiddleware;
8-
use Yiisoft\Yii\Middleware\Locale;
98

109
return [
1110
'middlewares' => [
1211
ErrorCatcher::class,
1312
SessionMiddleware::class,
14-
Locale::class,
1513
Router::class,
1614
],
17-
18-
'locale' => [
19-
'locales' => ['en' => 'en-US', 'ru' => 'ru-RU', 'de' => 'de-DE'],
20-
'ignoredRequests' => [
21-
'/gii**',
22-
'/debug**',
23-
'/inspect**',
24-
],
25-
],
2615
];

src/EventHandler/SetLocaleEventHandler.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/Acceptance/HomeCest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,4 @@ public function testIndexPage(AcceptanceTester $I): void
1515
$I->expectTo('see page home.');
1616
$I->see('Hello!');
1717
}
18-
19-
public function testIndexPageRu(AcceptanceTester $I): void
20-
{
21-
$I->wantTo('home page works.');
22-
$I->amOnPage('/ru/');
23-
$I->expectTo('see page home.');
24-
$I->see('Привет!');
25-
}
2618
}

tests/Acceptance/NotFoundHandlerCest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function about(AcceptanceTester $I): void
1313
$I->amOnPage('/about');
1414
$I->wantTo('see about page.');
1515
$I->see('404');
16-
$I->see('The page /en/about not found.');
16+
$I->see('The page /about not found.');
1717
$I->see('The above error occurred while the Web server was processing your request.');
1818
$I->see('Please contact us if you think this is a server error. Thank you.');
1919
}
@@ -23,7 +23,7 @@ public function aboutReturnHome(AcceptanceTester $I): void
2323
$I->amOnPage('/about');
2424
$I->wantTo('see about page.');
2525
$I->see('404');
26-
$I->see('The page /en/about not found.');
26+
$I->see('The page /about not found.');
2727
$I->see('The above error occurred while the Web server was processing your request.');
2828
$I->see('Please contact us if you think this is a server error. Thank you.');
2929
$I->click('Go Back Home');

0 commit comments

Comments
 (0)