Skip to content

Commit 6e61fee

Browse files
committed
Fix with naming
1 parent 7fc977f commit 6e61fee

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Folklore/LaravelLocale/LocaleEventHandler.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@
55

66
class LocaleEventHandler
77
{
8-
98
/**
109
* Handle user login events.
1110
*/
1211
public function onRouteMatched(RouteMatched $event)
1312
{
14-
$app = app();
15-
$route = $event->route;
16-
$currentLocale = $app->getLocale();
17-
$action = $route->getAction();
13+
$locale = app()->getLocale();
14+
$action = $event->route->getAction();
1815
$locales = config('locale.locales');
19-
if (isset($action['locale']) && $action['locale'] !== $currentLocale && in_array($action['locale'], $locales)) {
20-
$app->setLocale($action['locale']);
16+
if (isset($action['locale']) && $action['locale'] !== $locale && in_array($action['locale'], $locales)) {
17+
app()->setLocale($action['locale']);
2118
}
2219
}
2320

24-
public function onLocaleChanged($currentLocale)
21+
public function onLocaleChanged($locale)
2522
{
26-
app('locale.manager')->setLocale($currentLocale);
23+
app('locale.manager')->setLocale($locale);
2724
}
2825

2926
public function onLocaleUpdated(LocaleUpdated $event)

0 commit comments

Comments
 (0)